0

I have an extension that has some code to save a custom object via REST API service.

I have a try and catch (\Exception $e) around the save method, but for some reason I get the following message:

{
    "message":"Internal Error. Details are available in Magento log file. Report ID: webapi-5c481b2831e76"
}

The log shows:

main.CRITICAL: Report ID: webapi-5c481b2831e76; Message: Property "aaa" does not have corresponding setter in class "Company\Module\Api\Data\MyCustomClass"

I assume the error is being thrown from within the REST API code - because the object (which is in the method signature) is not able to be instantiated.

So how to catch this.

0

The data you sent had to be compatible with the param doc type and probably is a Data Service contract.

If you sent valid data then it will get in the try catch.

  • Hi Mr Lewis - I realise this, but if we are defining a REST service method then we should be able to return informative errors such as what is printed in the log. Not just 'please check log'. Any ideas on how to force this validation failure to return a proper error message? – BAF Jan 24 at 0:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.