(module: string, message: string, error?: Error)
| 231 | let notifyingErrorChannel = false; |
| 232 | |
| 233 | function notifyErrorChannel(module: string, message: string, error?: Error): void { |
| 234 | if (notifyingErrorChannel) return; |
| 235 | notifyingErrorChannel = true; |
| 236 | |
| 237 | import('../addie/error-notifier.js') |
| 238 | .then(({ notifySystemError }) => { |
| 239 | const errorDetail = error?.message && error.message !== message |
| 240 | ? sanitizeForSlack(`${message}: ${error.message}`) |
| 241 | : sanitizeForSlack(message); |
| 242 | const stack = error?.stack ? `\n\`\`\`${sanitizeForSlack(error.stack.slice(0, 500))}\`\`\`` : ''; |
| 243 | notifySystemError({ |
| 244 | source: module || 'unknown', |
| 245 | errorMessage: errorDetail + stack, |
| 246 | }); |
| 247 | }) |
| 248 | .catch(() => {}) |
| 249 | .finally(() => { notifyingErrorChannel = false; }); |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * Send a Slack notification for fatal-level errors. |
no test coverage detected