2 ms·
IMO the Promise API in javascript is incomplete when it comes to error handling. If you use the native implementation, all you have for error handling is .catch
by wonnage 11y ago
IMO the Promise API in javascript is incomplete when it comes to error handling. If you use the native implementation, all you have for error handling is .catch, but that changes the result of the computation. It would be extremely convenient to have out of band onSuccess/Failure/Complete lifecycle callbacks which don't have return values, but do let you perform logging, etc. on the side without affecting the result. You wind up having to catch errors and re-throw them, which is error-prone and janky.