1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00
unleash.unleash/src/lib/types
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
..
models fix: make api tokens ui consistent and remove check for deprecated envs. (#3410) 2023-03-29 10:33:14 +03:00
settings Maintenance mode for users (#2716) 2022-12-21 13:23:44 +02:00
stores OpenAPI: addon operations (#3421) 2023-04-18 10:50:34 +00:00
api-user.ts chore: remove uses of type errors from user-facing code (#3553) 2023-04-18 13:42:07 +02:00
authentication-required.ts
core.ts
environment.ts
events.ts feat: bulk delete features (#3314) 2023-03-15 15:08:08 +02:00
experimental.ts feat: remove project overview flags (#3532) 2023-04-17 11:21:52 +02:00
favorites.ts Favorite features (#2550) 2022-11-29 16:06:08 +01:00
group.ts chore: remove uses of type errors from user-facing code (#3553) 2023-04-18 13:42:07 +02:00
index.ts Define exports for enterprise (#2435) 2022-11-17 13:02:40 +02:00
model.ts feat: add title to strategy (#3510) 2023-04-18 08:59:02 +02:00
mutable.ts refactor: add soft response schema validation (#1657) 2022-06-08 08:01:14 +02:00
no-auth-user.ts fix: configure user endpoint when AuthType is NONE (#1403) 2022-03-01 10:52:22 +01:00
openapi.d.ts feat: extend refs in openapi (#3170) 2023-02-22 13:10:29 +01:00
option.ts task: Expose prometheus metrics (#2586) 2022-12-12 14:05:56 +01:00
partial.ts feat: Permissions update import (#3141) 2023-02-17 11:58:55 +01:00
permissions.ts chore: add project-specific-segment permission (#3295) 2023-03-10 10:34:26 +01:00
project.ts
query.ts
saved.ts fix: validate the type and length of parameter values (#1559) 2022-05-04 15:16:18 +02:00
serialize-dates.test.ts refactor: add soft response schema validation (#1657) 2022-06-08 08:01:14 +02:00
serialize-dates.ts refactor: add soft response schema validation (#1657) 2022-06-08 08:01:14 +02:00
services.ts chore: refactor segments to stop depending on the implementation (#3315) 2023-03-15 14:58:19 +01:00
stores.ts feat: drop full- for import/validate (#3168) 2023-02-21 10:15:57 +01:00
user.test.ts
user.ts chore: remove uses of type errors from user-facing code (#3553) 2023-04-18 13:42:07 +02:00