MCPcopy Create free account
hub / github.com/dabbott/javascript-playgrounds / buildErrorMessage

Method buildErrorMessage

components/player/Sandbox.js:79–105  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

77 }
78
79 buildErrorMessage(e) {
80 let message = `${e.name}: ${e.message}`
81 let line = null
82
83 // Safari
84 if (e.line != null) {
85 line = e.line
86
87 // FF
88 } else if (e.lineNumber != null) {
89 line = e.lineNumber
90
91 // Chrome
92 } else if (e.stack) {
93 const matched = e.stack.match(/<anonymous>:(\d+)/)
94 if (matched) {
95 line = parseInt(matched[1])
96 }
97 }
98
99 if (typeof line === 'number') {
100 line -= prefixLineCount
101 message = `${message} (${line})`
102 }
103
104 return message
105 }
106
107 throwError(message) {
108 parent.postMessage(JSON.stringify({

Callers 2

player-bundle.jsFile · 0.80
runApplicationMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected