bxo 0.0.5-dev.19 → 0.0.5-dev.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +12 -4
- package/package.json +1 -1
package/index.ts
CHANGED
@@ -482,7 +482,6 @@ export default class BXO {
|
|
482
482
|
};
|
483
483
|
} catch (validationError) {
|
484
484
|
// Validation failed - return error response
|
485
|
-
const errorMessage = validationError instanceof Error ? validationError.message : 'Validation failed';
|
486
485
|
|
487
486
|
// Extract detailed validation errors from Zod
|
488
487
|
let validationDetails = undefined;
|
@@ -494,8 +493,13 @@ export default class BXO {
|
|
494
493
|
}
|
495
494
|
}
|
496
495
|
|
496
|
+
// Create a clean error message
|
497
|
+
const errorMessage = validationDetails && validationDetails.length > 0
|
498
|
+
? `Validation failed for ${validationDetails.length} field(s)`
|
499
|
+
: 'Validation failed';
|
500
|
+
|
497
501
|
return new Response(JSON.stringify({
|
498
|
-
error:
|
502
|
+
error: errorMessage,
|
499
503
|
details: validationDetails
|
500
504
|
}), {
|
501
505
|
status: 400,
|
@@ -538,7 +542,6 @@ export default class BXO {
|
|
538
542
|
response = this.validateData(route.config.response, response);
|
539
543
|
} catch (validationError) {
|
540
544
|
// Response validation failed
|
541
|
-
const errorMessage = validationError instanceof Error ? validationError.message : 'Response validation failed';
|
542
545
|
|
543
546
|
// Extract detailed validation errors from Zod
|
544
547
|
let validationDetails = undefined;
|
@@ -550,8 +553,13 @@ export default class BXO {
|
|
550
553
|
}
|
551
554
|
}
|
552
555
|
|
556
|
+
// Create a clean error message
|
557
|
+
const errorMessage = validationDetails && validationDetails.length > 0
|
558
|
+
? `Response validation failed for ${validationDetails.length} field(s)`
|
559
|
+
: 'Response validation failed';
|
560
|
+
|
553
561
|
return new Response(JSON.stringify({
|
554
|
-
error:
|
562
|
+
error: errorMessage,
|
555
563
|
details: validationDetails
|
556
564
|
}), {
|
557
565
|
status: 500,
|