(message, type = ErrorTypes.UNKNOWN, userMessage = null, context = {})
| 27 | |
| 28 | export class TitanBotError extends Error { |
| 29 | constructor(message, type = ErrorTypes.UNKNOWN, userMessage = null, context = {}) { |
| 30 | super(message); |
| 31 | this.name = 'TitanBotError'; |
| 32 | this.type = type; |
| 33 | this.userMessage = userMessage; |
| 34 | this.context = context; |
| 35 | this.code = context?.errorCode || getDefaultErrorCodeByType(type); |
| 36 | this.timestamp = new Date().toISOString(); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | export function categorizeError(error) { |
nothing calls this directly
no test coverage detected