@@ -133,16 +133,16 @@ window.onunhandledrejection = async function onUnhandledRejection(event) {
133
133
} ;
134
134
135
135
// Monkeypatch p5._friendlyError
136
- // const friendlyError = window.p5._friendlyError ;
137
- // window.p5._friendlyError = function (message, method, color) {
138
- // const urls = Object.keys(window.objectUrls);
139
- // const paths = Object.keys(window.objectPaths);
140
- // let newMessage = message;
141
- // urls.forEach((url) => {
142
- // newMessage = newMessage.replaceAll(url, window.objectUrls[url]);
143
- // });
144
- // paths.forEach((path) => {
145
- // newMessage = newMessage.replaceAll(path, window.objectPaths[path]);
146
- // });
147
- // friendlyError .apply(window.p5, [newMessage, method, color]);
148
- // };
136
+ const { _report } = window . p5 ;
137
+ window . p5 . _report = function resolvedReport ( message , method , color ) {
138
+ const urls = Object . keys ( window . objectUrls ) ;
139
+ const paths = Object . keys ( window . objectPaths ) ;
140
+ let newMessage = message ;
141
+ urls . forEach ( ( url ) => {
142
+ newMessage = newMessage . replaceAll ( url , window . objectUrls [ url ] ) ;
143
+ } ) ;
144
+ paths . forEach ( ( path ) => {
145
+ newMessage = newMessage . replaceAll ( path , window . objectPaths [ path ] ) ;
146
+ } ) ;
147
+ _report . apply ( window . p5 , [ newMessage , method , color ] ) ;
148
+ } ;
0 commit comments