* Extract line and column from error stack or message
(errorMessage, stack)
| 76 | * Extract line and column from error stack or message |
| 77 | */ |
| 78 | function 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 |
no outgoing calls
no test coverage detected