mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] app: rethrow errors that were not handled
This commit makes it so that when an error occurs in an owl app and none of the registered error handlers are able to handle it, we rethrow the error instead of just logging it to the console and swallowing it. This allows users of owl to handle errors that happen in owl applications by using event listeners for error and unhandledrejection events on the window.
This commit is contained in:
committed by
Géry Debongnie
parent
a5a6a592c1
commit
cfdf7caa50
@@ -261,6 +261,20 @@ expect.extend({
|
||||
},
|
||||
});
|
||||
|
||||
export function nextAppError(app: any) {
|
||||
const { handleError } = app;
|
||||
return new Promise((resolve) => {
|
||||
app.handleError = (...args: Parameters<typeof handleError>) => {
|
||||
try {
|
||||
handleError.call(app, ...args);
|
||||
} catch (e: any) {
|
||||
app.handleError = handleError;
|
||||
resolve(e);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace jest {
|
||||
interface Matchers<R> {
|
||||
|
||||
Reference in New Issue
Block a user