File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
live-view/extensions/mobile-console Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -203,15 +203,15 @@ let logger = {
203203 // remove the first empty item (because of how split works)
204204 stack . shift ( ) ;
205205
206- } else {
206+ } else if ( stack ) {
207207
208208 // split stack
209209 stack = stack . split ( '\n' ) ;
210210
211211 }
212212
213213
214- if ( ! isLoggerEval ) {
214+ if ( ! isLoggerEval && stack ) {
215215
216216 // replace absolute URLs with relative URLs in stack
217217
@@ -280,7 +280,7 @@ let logger = {
280280
281281 }
282282
283- } else {
283+ } else if ( stack ) {
284284
285285 if ( ! isSafari ) {
286286
@@ -305,6 +305,23 @@ let logger = {
305305
306306 }
307307
308+ } else if ( isSafari ) {
309+
310+ // the error's line number and column number
311+ // sometimes aren't available in the stack on Safari,
312+ // so we need to get them from the Error object
313+
314+ let entryURL = error . sourceURL ;
315+
316+ // replace index URLs
317+ entryURL = entryURL . replaceAll ( indexURL , '(index)' ) ;
318+
319+ // remove absolute URLs' origin
320+ entryURL = entryURL . replaceAll ( originURL , '' ) ;
321+
322+ // save entry in stack
323+ stack = [ entryURL + ':' + error . line + ':' + error . column ] ;
324+
308325 }
309326
310327
You can’t perform that action at this time.
0 commit comments