You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix#180: use BloomreachBuddyError everywhere with structured codes and recovery hints (#192)
- Create packages/core/src/errors.ts with ERROR_CODES, BloomreachBuddyError
(with details field), BloomreachApiError, and toErrorPayload()
- Convert all 692 throw new Error() across 39 service files to
BloomreachBuddyError with appropriate error codes
- Map validation errors to ACTION_PRECONDITION_FAILED
- Map missing API credentials to CONFIG_MISSING with details.missing
- Map 'not yet implemented' to ACTION_PRECONDITION_FAILED with
details.not_implemented flag
- Map unexpected API responses to API_ERROR
- Update MCP toolResults.ts to return structured payloads with code,
message, details, and recovery_hint
- Update MCP toolArgs.ts, toolSchema.ts, bloomreach-mcp.ts
- Update CLI bloomreach.ts
- All 9738 tests pass, lint clean, typecheck clean, build succeeds
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED','API key name must not be empty.');
148
147
}
149
148
if(trimmed.length>MAX_API_KEY_NAME_LENGTH){
150
-
thrownewError(
151
-
`API key name must not exceed ${MAX_API_KEY_NAME_LENGTH} characters (got ${trimmed.length}).`,
152
-
);
149
+
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED',`API key name must not exceed ${MAX_API_KEY_NAME_LENGTH} characters (got ${trimmed.length}).`);
@@ -210,10 +207,8 @@ class InviteTeamMemberExecutor implements AccessActionExecutor {
210
207
_payload: Record<string,unknown>,
211
208
): Promise<Record<string,unknown>>{
212
209
voidthis.apiConfig;
213
-
thrownewError(
214
-
'InviteTeamMemberExecutor: not yet implemented. '+
215
-
'Team member invitation is only available through the Bloomreach Engagement UI.',
216
-
);
210
+
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED','InviteTeamMemberExecutor: not yet implemented. '+
211
+
'Team member invitation is only available through the Bloomreach Engagement UI.',{not_implemented: true});
217
212
}
218
213
}
219
214
@@ -229,10 +224,8 @@ class UpdateMemberRoleExecutor implements AccessActionExecutor {
229
224
_payload: Record<string,unknown>,
230
225
): Promise<Record<string,unknown>>{
231
226
voidthis.apiConfig;
232
-
thrownewError(
233
-
'UpdateMemberRoleExecutor: not yet implemented. '+
234
-
'Member role updates are only available through the Bloomreach Engagement UI.',
235
-
);
227
+
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED','UpdateMemberRoleExecutor: not yet implemented. '+
228
+
'Member role updates are only available through the Bloomreach Engagement UI.',{not_implemented: true});
236
229
}
237
230
}
238
231
@@ -248,10 +241,8 @@ class RemoveTeamMemberExecutor implements AccessActionExecutor {
248
241
_payload: Record<string,unknown>,
249
242
): Promise<Record<string,unknown>>{
250
243
voidthis.apiConfig;
251
-
thrownewError(
252
-
'RemoveTeamMemberExecutor: not yet implemented. '+
253
-
'Team member removal is only available through the Bloomreach Engagement UI.',
254
-
);
244
+
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED','RemoveTeamMemberExecutor: not yet implemented. '+
245
+
'Team member removal is only available through the Bloomreach Engagement UI.',{not_implemented: true});
255
246
}
256
247
}
257
248
@@ -267,10 +258,8 @@ class CreateApiKeyExecutor implements AccessActionExecutor {
267
258
_payload: Record<string,unknown>,
268
259
): Promise<Record<string,unknown>>{
269
260
voidthis.apiConfig;
270
-
thrownewError(
271
-
'CreateApiKeyExecutor: not yet implemented. '+
272
-
'API key creation is only available through the Bloomreach Engagement UI.',
273
-
);
261
+
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED','CreateApiKeyExecutor: not yet implemented. '+
262
+
'API key creation is only available through the Bloomreach Engagement UI.',{not_implemented: true});
274
263
}
275
264
}
276
265
@@ -286,10 +275,8 @@ class DeleteApiKeyExecutor implements AccessActionExecutor {
286
275
_payload: Record<string,unknown>,
287
276
): Promise<Record<string,unknown>>{
288
277
voidthis.apiConfig;
289
-
thrownewError(
290
-
'DeleteApiKeyExecutor: not yet implemented. '+
291
-
'API key deletion is only available through the Bloomreach Engagement UI.',
292
-
);
278
+
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED','DeleteApiKeyExecutor: not yet implemented. '+
279
+
'API key deletion is only available through the Bloomreach Engagement UI.',{not_implemented: true});
293
280
}
294
281
}
295
282
@@ -332,21 +319,17 @@ export class BloomreachAccessManagementService {
332
319
if(input!==undefined){
333
320
validateProject(input.project);
334
321
}
335
-
thrownewError(
336
-
'listTeamMembers: not yet implemented. the Bloomreach API does not provide an endpoint for team members. '+
337
-
'Team members must be managed through the Bloomreach Engagement UI (navigate to Project Settings > Project Team).',
338
-
);
322
+
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED','listTeamMembers: not yet implemented. the Bloomreach API does not provide an endpoint for team members. '+
323
+
'Team members must be managed through the Bloomreach Engagement UI (navigate to Project Settings > Project Team).',{not_implemented: true});
'listApiKeys: not yet implemented. the Bloomreach API does not provide an endpoint for API keys. '+
348
-
'API keys must be managed through the Bloomreach Engagement UI (navigate to Project Settings > API).',
349
-
);
331
+
thrownewBloomreachBuddyError('ACTION_PRECONDITION_FAILED','listApiKeys: not yet implemented. the Bloomreach API does not provide an endpoint for API keys. '+
332
+
'API keys must be managed through the Bloomreach Engagement UI (navigate to Project Settings > API).',{not_implemented: true});
0 commit comments