promiseのcatch,then
<apex:page>
<html>
<head>
</head>
<body>
<script type="text/javascript">
Promise.resolve()
.then(() => {
// Makes .then() return a rejected promise
throw new Error('Oh no!');
})
.catch(error => {
console.error('onRejected function called: ' + error.message);
})
.then(() => {
console.log("I am always called even if the prior then's promise rejects");
});
</script>
</body>
</html>
</apex:page>
結果