(message: string, code: number, path?: string[])
| 126 | * be reused later, before throwing the final error. |
| 127 | */ |
| 128 | export function createRuntimeError(message: string, code: number, path?: string[]): Error { |
| 129 | // Cast to `any`, so that extra info can be monkey-patched onto this instance. |
| 130 | const error = new RuntimeError(code, message) as any; |
| 131 | |
| 132 | // Monkey-patch a runtime error code and a path onto an Error instance. |
| 133 | error[NG_RUNTIME_ERROR_CODE] = code; |
| 134 | error[NG_RUNTIME_ERROR_MESSAGE] = message; |
| 135 | if (path) { |
| 136 | error[NG_TOKEN_PATH] = path; |
| 137 | } |
| 138 | return error; |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * Reads monkey-patched error code from the given Error instance. |
no outgoing calls
no test coverage detected
searching dependent graphs…