Fix exposing the error#15
Conversation
Using a promise for the setTimeout call is broken in this case, as the error would again be thrown in a promise operation, and so not exposed
|
Do you have an example of this not working? I added some |
|
I guess you added it in places which are not running inside a promise but before the promise is used (and util.exposeError was not involved at all in the error handling then). And so the error does not cause the method to return a rejected promise on error but to trigger an exception instead. This is an issue which happens when the API is partially synchronous and partially promised-based. Try this patch to trigger an error in a place running inside a promise: diff --git a/src/js/regexper.js b/src/js/regexper.js
index fea7c4b..27b2a9b 100644
--- a/src/js/regexper.js
+++ b/src/js/regexper.js
@@ -226,6 +226,7 @@ export default class Regexper {
})
// When parsing is successful, render the parsed expression.
.then(parser => {
+ throw new Error('Debug');
return parser.render();
})
// Once rendering is complete:The error will not appear in the console because the exception triggered in exposeError just cause the |
|
Thank you for the test case. |
Using a promise for the setTimeout call is broken in this case, as the error would again be thrown in a promise operation, and so not exposed