mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-13 11:17:26 +02:00
This PR improves our handling of internal Joi errors, to make them more sensible to the end user. It does that by providing a better description of the errors and by telling the user what they value they provided was. Previous conversion: ```json { "id": "705a8dc0-1198-4894-9015-f1e5b9992b48", "name": "BadDataError", "message": "\"value\" must contain at least 1 items", "details": [ { "message": "\"value\" must contain at least 1 items", "description": "\"value\" must contain at least 1 items" } ] } ``` New conversion: ```json { "id": "87fb4715-cbdd-48bb-b4d7-d354e7d97380", "name": "BadDataError", "message": "Request validation failed: your request body contains invalid data. Refer to the `details` list for more information.", "details": [ { "description": "\"value\" must contain at least 1 items. You provided [].", "message": "\"value\" must contain at least 1 items. You provided []." } ] } ``` ## Restructuring This PR moves some code out of `unleash-error.ts` and into a new file. The purpose of this is twofold: 1. avoid circular dependencies (we need imports from both UnleashError and BadDataError) 2. carve out a clearer separation of concerns, keeping `unleash-error` a little more focused. |
||
---|---|---|
.. | ||
project | ||
user | ||
addon.ts | ||
api-token.ts | ||
archive.ts | ||
client-metrics.ts | ||
config.test.ts | ||
config.ts | ||
constraints.ts | ||
context.test.ts | ||
context.ts | ||
email.test.ts | ||
email.ts | ||
environments.ts | ||
event.ts | ||
events.test.ts | ||
favorites.ts | ||
feature-type.ts | ||
feature.ts | ||
index.ts | ||
instance-admin.ts | ||
maintenance.ts | ||
metrics.test.ts | ||
metrics.ts | ||
playground.test.ts | ||
playground.ts | ||
public-signup.test.ts | ||
public-signup.ts | ||
state.ts | ||
strategy.test.ts | ||
strategy.ts | ||
tag-type.ts | ||
tag.test.ts | ||
tag.ts | ||
user-admin.ts | ||
user-feedback.ts | ||
user-splash.ts |