In Magento 2.3, How to add custom error code with response
-
13-03-2021 - |
Question
In Magento 2.3, How to add custom error code along with response. For example, If I add the code as below, I am getting this below response:
throw new InvalidEmailOrPasswordException(__('Invalid login or password.'), null, 900)
"message": "Invalid login or password.",
"code": 900,
"trace": "#0 [internal function]
But this is only accepting integer(900), not any characters. Is any poosibility to add this characters in the code. Thanks in Advance.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange