Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import type { LinearErrorCode, LinearIncludeErrorCode } from '../../shared/linear-agent-access'
|
||||
import { boundedIntegrationErrorMessage } from '../integration-error-message'
|
||||
|
||||
export class LinearAgentAccessError extends Error {
|
||||
readonly code: LinearErrorCode
|
||||
readonly data?: unknown
|
||||
|
||||
constructor(code: LinearErrorCode, message: string, data?: unknown) {
|
||||
super(boundedIntegrationErrorMessage(message))
|
||||
super(message)
|
||||
this.name = 'LinearAgentAccessError'
|
||||
this.code = code
|
||||
this.data = data
|
||||
@@ -59,12 +58,13 @@ export function classifyLinearError(error: unknown): LinearErrorCode {
|
||||
}
|
||||
|
||||
export function linearMessage(error: unknown): string {
|
||||
return sanitizeLinearErrorMessage(boundedIntegrationErrorMessage(error))
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
return sanitizeLinearErrorMessage(message)
|
||||
}
|
||||
|
||||
export function sanitizeLinearErrorMessage(message: string): string {
|
||||
// Why: provider text is useful in CLI errors, but raw SDK failures can embed secrets or user payloads.
|
||||
return stripLinearStackTrace(boundedIntegrationErrorMessage(message))
|
||||
return stripLinearStackTrace(message)
|
||||
.replace(
|
||||
/(headers?\s*[:=]\s*)\{[^{}]*(?:authorization|token|api[-_]?key)[^{}]*\}/gi,
|
||||
'$1[REDACTED]'
|
||||
|
||||
Reference in New Issue
Block a user