0
nhontran created
Hi, I want to throw BusinessException with custom message without passing the error code or using error code does not exist in en.json:
// no error code
throw new BusinessException(null, "custom error message", null);
// error code does not exist
throw new BusinessException("NoErrorCode", "custom error message", null);
But received the output as below:
// no error code
{
"error": {
"code": null,
"message": "An internal error occurred during your request!",
"details": null,
"data": {},
"validationErrors": null
}
}
// error code does not exist
{
"error": {
"code": "NoErrorCode",
"message": "An internal error occurred during your request!",
"details": null,
"data": {},
"validationErrors": null
}
}
Any idea?
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
3 Answer(s)
-
0
Hi, you can use throw
UserFriendlyExceptionfor this purpose.See the documentation for more info.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)