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?
3 Answer(s)
-
0
Hi, anyone can help us on this query?
-
0
Hi, you can use throw
UserFriendlyException
for this purpose.See the documentation for more info.
-
0
Hi @EngicanV, thanks for the reply.