Error is handled even if error message is not defined
Added default error message
Validation error is left unhandled (same as before). Further improvements could be made. It would be possible to return response on error without a fatal using IResponse errors
Everything is fine except there are some minor linting errors and some changes to variable names. I'll be fixing those in a separate branch and then merging with dev.
I tried to keep error handling as close as possible to the original logic, but I did make some changes:
Validation error is left unhandled (same as before). Further improvements could be made. It would be possible to return response on error without a fatal using IResponse errors
Everything is tested and confirmed to be working.
Please comment if you want me to make changes.