1

I need to return error codes instead of messages in the exception.

For example, what I am looking for is below

throw new \Magento\Framework\Exception\LocalizedException(__("number is incorrect"),"Err123");

So that only Err123 is will be returned as web API output instead of the message.

Is there a way to do this with existing Exception classes or a new exception class needs to be created?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.