budibase/packages/string-templates/src/errors.ts

21 lines
502 B
TypeScript
Raw Normal View History

2024-10-03 17:16:42 +02:00
export class JsTimeoutError extends Error {
static message = "Timed out while executing JS"
static code = "JS_TIMEOUT_ERROR"
code: string = JsTimeoutError.code
constructor() {
super(JsTimeoutError.message)
}
}
export class UserScriptError extends Error {
2024-10-03 16:56:19 +02:00
static code = "USER_SCRIPT_ERROR"
2024-10-03 17:16:42 +02:00
code: string = UserScriptError.code
constructor(readonly userScriptError: Error) {
super(
2024-10-03 14:11:01 +02:00
`error while running user-supplied JavaScript: ${userScriptError.toString()}`
)
}
}