1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-19 17:52:45 +02:00
unleash.unleash/src
Thomas Heartman 34204c3565
chore: remove uses of type errors from user-facing code (#3553)
BREAKING CHANGE: This changes the `name` property of a small number of error responses that we return. The property would have been `TypeError`, but is now `ValidationError` instead. It's a grey area, but I'd rather be strict.

---

This change removes uses of the `TypeError` type from user-facing code.
Type errors are used by typescript when you provide it the wrong type.
This is a valid concern. However, in the API, they're usually a signal
that **we've** done something wrong rather than the user having done
something wrong. As such, it makes more sense to return them as
validation errors or bad request errors.

## Breaking changes

Note that because of the way we handle errors, some of these changes
will be made visible to the end user, but only in the response body.

```ts
{ "name": "TypeError", "message": "Something is wrong", "isJoi": true }
```

will become

```ts
{ "name": "ValidationError", "message": "Something is wrong", "isJoi": true }
```

Technically, this could be considered a breaking change. However, as
we're gearing up for v5, this might be a good time to merge that?

## A return to 500

This PR also makes TypeErrors a 500-type error again because they should
never be caused by invalid data provided by the user
2023-04-18 13:42:07 +02:00
..
lib chore: remove uses of type errors from user-facing code (#3553) 2023-04-18 13:42:07 +02:00
mailtemplates refactor: move docs into new structure / fix links for SEO (#2416) 2022-11-22 09:05:30 +00:00
migrations feat: add title to strategy (#3510) 2023-04-18 08:59:02 +02:00
test OpenAPI: addon operations (#3421) 2023-04-18 10:50:34 +00:00
migrator.ts feat: disable verbosity from db-migrate (#3301) 2023-03-13 10:12:43 +01:00
server-dev.ts feat: remove project overview flags (#3532) 2023-04-17 11:21:52 +02:00
server.ts