File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,13 @@ import patches from './patches.js';
2
2
import markPatched from './markPatched.js' ;
3
3
import scanURL from './scanURL.js' ;
4
4
5
+ function patchFailed ( name , err ) {
6
+ console . error ( `Patch ${ name } failed! ${ err } ` ) ;
7
+ if ( err . stack ) {
8
+ console . error ( err . stack ) ;
9
+ }
10
+ }
11
+
5
12
export default async function scanElement ( elem ) {
6
13
if ( ! elem . classList || ! elem . classList . contains ) return ;
7
14
@@ -28,7 +35,13 @@ export default async function scanElement(elem) {
28
35
if ( patch . applied ( match ) ) continue ;
29
36
}
30
37
31
- applications . push ( patch . apply ( match ) ) ;
38
+ try {
39
+ const promise = Promise . resolve ( patch . apply ( match ) ) ;
40
+ const handled = promise . catch ( err => patchFailed ( patch . name , err ) ) ;
41
+ applications . push ( handled ) ;
42
+ } catch ( err ) {
43
+ patchFailed ( patch . name , err ) ;
44
+ }
32
45
}
33
46
}
34
47
You can’t perform that action at this time.
0 commit comments