MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / sanitizeErrorMessage

Function sanitizeErrorMessage

sdk/src/error-utils.ts:103–117  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

101 * Removes sensitive information and formats for user consumption
102 */
103export function sanitizeErrorMessage(error: unknown): string {
104 if (error instanceof Error) {
105 return error.message
106 }
107 if (typeof error === 'string') {
108 return error
109 }
110 if (error && typeof error === 'object' && 'message' in error) {
111 const message = (error as { message: unknown }).message
112 if (typeof message === 'string') {
113 return message
114 }
115 }
116 return String(error)
117}

Callers 2

formatErrorForDisplayFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected