Sorry @kamilmysliwiec but this behavior of breaking changes is for me unacceptable.
For code like:
throw new ForbiddenException('Forbidden resource');
It was smth like:
{
"statusCode": 403,
"message": "Forbidden resource"
}
But now it change from a "message" to a "error" key, as:
{
"statusCode": 403,
"message": "Forbidden",
"error": "Forbidden resource"
}
Like why? Why did you change a message
key to an error
? This is misleading, from the beginning of javascript life, Error
object at the first constructor parameter take a message
, and now it's changed to an error
key?!
This is kind of reinventing the wheel?
I do not have any commit or pr for this.
Described at the first paragraph.
Code at the first paragraph.
I would love to have as it was, message key from a constructor should be a message in error response. If not, then I will have to rebuilt a lot of applications, or override a default error handler for no good reason.
Nest version: 7.0.0
For Tooling issues:
- Node version: v12.13.1
- Platform: Linux
Others:
PR https://github.com/nestjs/nest/pull/4045
Related:
However, you're right - the order of parameters is wrong. The first argument should be used for message
key of Error
object, and thus (again, for the sake of consistency), for the response object. When not passed, the constructor should fallback to a generic message. Fixed in 7.0.2, will update docs asap
Thank you @kamilmysliwiec <3
Most helpful comment
PR https://github.com/nestjs/nest/pull/4045
Related:
However, you're right - the order of parameters is wrong. The first argument should be used for
message
key ofError
object, and thus (again, for the sake of consistency), for the response object. When not passed, the constructor should fallback to a generic message. Fixed in 7.0.2, will update docs asap