Introduction
Like Exceptions, since
ES2018 JavaScript
Promises also support .finally().
Syntax
promise
.then((result) => {})
.catch((error) => {})
.finally(() => {});Shorthand
promise.finally(() => {});is equal to
promise.then(
(result) => {
return result;
},
(error) => {
throw error;
}
);