Commit Graph

87 Commits

Author SHA1 Message Date
Kamil Myśliwiec
236b633a76 style: address integration tests lint errors 2024-11-26 09:39:20 +01:00
Kamil Myśliwiec
35846843e1 feat(common): allow passing number to http error create body #12787 2024-11-12 11:12:41 +01:00
Bendegúz Kálmán
f793e2a1d2 docs(common): remove incorrect constructor signature of HttpException
HttpException cannot be instantiated with zero arguments. The provided first example is misleading.
2024-02-17 16:36:37 +01:00
Kamil Mysliwiec
efa9909b63 Merge pull request #11673 from namoscato/fix-11665-error-cause-type
fix(common): loosen http exception cause type
2023-06-12 12:31:48 +02:00
Nick Amoscato
41552d398e fix(common): loosen http exception cause type
resolves #11665
2023-05-26 08:45:00 -04:00
Kamil Myśliwiec
5820bed145 chore: resolve conflicts 2023-05-19 12:33:43 +02:00
Kamil Myśliwiec
8b74665bdf chore: remove deprecated types, utils, logic 2023-04-11 13:34:10 +02:00
Dima Parzhitsky
48e25d4080 chore: improve typings of .createBody(…)
Add overload signatures to `HttpException.createBody(…)` to reflect different ways of creating it:

```ts
createBody(<message>, <error>, <statusCode>);
createBody(<messages>, <error>, <statusCode>);
createBody(null, <message>, <statusCode>);
createBody(null, <messages>, <statusCode>);
createBody(<custom>);
```

Signed-off-by: Dima Parzhitsky <parzhitsky@gmail.com>
2023-04-05 14:43:45 +03:00
codytseng
25dd621132 Merge branch 'master' into fix-middleware-global-prefix 2023-02-01 22:36:47 +08:00
Kamil Mysliwiec
967a136834 Merge pull request #10201 from nkitku/patch-1
Fix HTTPException on minifying class names, its not match regex expre…
2023-02-01 13:17:30 +01:00
Tony133
8447ac117f refactor(): improvements and update imports 2023-01-09 22:16:12 +01:00
Thiago Martins
45b6cc1047 test(common): add http exception tests
add tests for all HttpException children classes and fix NotAcceptableException wrong status code.
2022-10-27 17:37:27 -03:00
Thiago Martins
379b82c189 feat(common): add error cause option
add error cause option to UnsupportedMediaTypeException.
2022-10-27 17:20:03 -03:00
Thiago Martins
b4aca5d01f feat(common): add error cause option
add error cause option to UnprocessableEntityException.
2022-10-27 17:18:54 -03:00
Thiago Martins
f62acac815 feat(common): add error cause option
add error cause option to UnauthorizedException.
2022-10-27 17:17:26 -03:00
Thiago Martins
e8abd9af20 feat(common): add error cause option
add error cause option to ServiceUnavailableException.
2022-10-27 17:16:21 -03:00
Thiago Martins
5031f4105f feat(common): add error cause option
add error cause option to RequestTimeoutException.
2022-10-27 17:15:04 -03:00
Thiago Martins
d40ebd17bf feat(common): add error cause option
add error cause option to PreconditionFailedException.
2022-10-27 17:11:25 -03:00
Thiago Martins
dfc28fcd28 feat(common): add error cause option
add error cause option to PayloadTooLargeException.
2022-10-27 17:08:47 -03:00
Thiago Martins
2416df695a feat(common): add error cause option
add error cause option to NotImplementedException.
2022-10-27 17:07:33 -03:00
Thiago Martins
d569aaa68d feat(common): add error cause option
add error cause option to NotFoundException.
2022-10-27 17:06:10 -03:00
Thiago Martins
3a10258bc4 feat(common): add error cause option
add error cause option to NotAcceptableException.
2022-10-27 17:03:37 -03:00
Thiago Martins
cd44ff3696 feat(common): add error cause option
add error cause option to MisdirectedException.
2022-10-27 17:02:06 -03:00
Thiago Martins
789e99cb3b feat(common): add error cause option
add error cause option to MethodNotAllowedException.
2022-10-27 17:00:15 -03:00
Thiago Martins
b81514384b feat(common): add error cause option
add error cause option to InternalServerErrorException.
2022-10-27 16:58:42 -03:00
Thiago Martins
11d276368a feat(common): add error cause option
add error cause option to ImATeapotException.
2022-10-27 16:56:50 -03:00
Thiago Martins
0328a5c031 feat(common): add error cause option
add error cause option to HttpVersionNotSupportedException.
2022-10-27 16:54:31 -03:00
Thiago Martins
bd7daf11c5 feat(common): add error cause option
add error cause option to GoneException.
2022-10-27 16:51:26 -03:00
Thiago Martins
f629dc1d71 feat(common): add error cause option
add error cause option to GatewayTimeoutException.
2022-10-27 16:50:00 -03:00
Thiago Martins
c3ced1d17e feat(common): add error cause option
add error cause option to ForbiddenException.
2022-10-27 16:19:49 -03:00
Thiago Martins
1dff9c0001 docs(common): update exception docs
update HttpException children classes docs to reflect the changes to the "description" parameter
2022-10-27 16:17:50 -03:00
Thiago Martins
88ac6aa463 feat(common): add error cause option
add error cause option to ConflictException.
2022-10-27 16:16:03 -03:00
Thiago Martins
5a186af18d docs(common): add static method docs
add docs for HttpException.getHttpExceptionOptionsFrom explaining its intended usage.
2022-10-27 16:08:49 -03:00
Thiago Martins
a4a8557847 refactor(common): extract description and options
create HttpException#extractDescriptionAndOptionsFrom method to return both description and options at the same time
2022-10-27 16:06:15 -03:00
Thiago Martins
7a710354c4 refactor(common): extract description and options
extract functions that provide valid values for description and http exception options to the HttpException class
2022-10-27 15:46:03 -03:00
Thiago Martins
60cb953e59 feat(common): add error cause option
add error cause option to BadGatewayException.
2022-10-27 15:31:39 -03:00
Thiago Martins
c5c818e8b7 chore(common): change deprecated message 2022-10-27 15:25:41 -03:00
Thiago Martins
4ded779f1f refactor(common): add description attribute
add description attribute to HttpExceptionOptions interface so we can reuse it among children exceptions.
2022-10-27 12:12:11 -03:00
Thiago Martins
7e763fa0ac refactor(common): rename method parameter
rename HttpException createBody method parameter to better represent its usage. When this parameter is a string, it is used as a value to a 'message' key in the final object.
2022-10-26 15:22:48 -03:00
Thiago Martins
071c4c5db9 refactor(common): change parameter assignment
change BadRequestException constructor parameters assignment to be clearer.
2022-10-26 14:20:15 -03:00
Thiago Martins
587fbaefe5 feat(common): add error cause option
add error cause option to bad request exception.
2022-10-26 14:14:55 -03:00
Thiago Martins
f5edb0f2a0 chore(common): add deprecated warning
add deprecated warning for HttpException class when using the first argument as the error cause.
2022-10-26 09:35:18 -03:00
Thiago Martins
b5fe06d642 feat(common): add error options object
add error options object to HttpException constructor to allow use of error cause along with custom message.
2022-10-25 18:12:41 -03:00
nkitku
f3e6c54b3e Fix HTTPException on minifying class names, its not match regex expression
```js
"BadRequest".match(/[A-Z][a-z]+|[0-9]+/g).join(' ') // this is ok 
// but on minify 
"t".match(/[A-Z][a-z]+|[0-9]+/g).join(' ') // throws error
// Uncaught TypeError: Cannot read properties of null (reading 'join')
```
2022-08-30 11:47:26 +05:30
Vincent Taverna
727b239515 Add public cause attribute 2022-06-01 15:04:29 -04:00
Vincent Taverna
32d1e9617b feat(common): Add error chaining support to http exception
Adds the ability to configure the cause of an error when passing an error object to http exception.
- https://nodejs.org/en/blog/release/v16.9.0/#error-cause
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error#rethrowing_an_error_with_a_cause
- https://github.com/microsoft/TypeScript/issues/45167
2022-05-25 10:34:53 -04:00
Micael Levi (@micalevisk)
5ad8f2ba57 docs(common): update hyperlinks on @see tag comments 2022-03-25 16:54:27 -04:00
Andrii
f934e7848d Fix typo in ImATeapotException doc :D 2021-11-03 17:59:13 +02:00
Kamil Myśliwiec
e0df01f80e chore(): resolve merge conflicts 2021-01-27 12:13:23 +01:00
Kamil Mysliwiec
a69109ee19 Merge branch '8.0.0' into fix-set-name-property-of-exception-object-equal-to-class-name 2021-01-27 12:09:34 +01:00