MCPcopy Index your code
hub / github.com/simstudioai/sim / extractLineInfo

Function extractLineInfo

apps/sim/lib/execution/isolated-vm-worker.cjs:78–105  ·  view source on GitHub ↗

* Extract line and column from error stack or message

(errorMessage, stack)

Source from the content-addressed store, hash-verified

76 * Extract line and column from error stack or message
77 */
78function extractLineInfo(errorMessage, stack) {
79 if (stack) {
80 const stackMatch = stack.match(/(?:<isolated-vm>|user-function\.js):(\d+):(\d+)/)
81 if (stackMatch) {
82 return {
83 line: Number.parseInt(stackMatch[1], 10),
84 column: Number.parseInt(stackMatch[2], 10),
85 }
86 }
87 const atMatch = stack.match(/at\s+(?:<isolated-vm>|user-function\.js):(\d+):(\d+)/)
88 if (atMatch) {
89 return {
90 line: Number.parseInt(atMatch[1], 10),
91 column: Number.parseInt(atMatch[2], 10),
92 }
93 }
94 }
95
96 const msgMatch = errorMessage.match(/:(\d+):(\d+)/)
97 if (msgMatch) {
98 return {
99 line: Number.parseInt(msgMatch[1], 10),
100 column: Number.parseInt(msgMatch[2], 10),
101 }
102 }
103
104 return {}
105}
106
107/**
108 * Convert isolated-vm error info to a format compatible with the route's error handling

Callers 1

convertToCompatibleErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected