MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / constructor

Method constructor

packages/baseai/src/dev/hono/errors.ts:142–163  ·  view source on GitHub ↗
({
		code,
		validationResult,
		customMessage
	}: {
		code: ErrorCodesType;
		validationResult: { success: boolean; error?: ZodError };
		customMessage?: string;
	})

Source from the content-addressed store, hash-verified

140 public readonly code: ErrorCodesType;
141
142 constructor({
143 code,
144 validationResult,
145 customMessage
146 }: {
147 code: ErrorCodesType;
148 validationResult: { success: boolean; error?: ZodError };
149 customMessage?: string;
150 }) {
151 let message = '';
152 if (validationResult.error) {
153 const _customMessage = customMessage ? customMessage : ``;
154 let _validationMessage = fromZodError(
155 validationResult.error
156 ).toString();
157 message = `${_customMessage} HINT: ${_validationMessage}`.trim();
158 }
159
160 super(codeToStatus(code), { message });
161 this.code = code;
162 this.cause = validationResult.error;
163 }
164
165 // Helper static method to simplify throwing errors
166 static handle({

Callers

nothing calls this directly

Calls 1

codeToStatusFunction · 0.85

Tested by

no test coverage detected