Error Handler â
Snappy has error handler that centralizes error management and streamlines debugging. It supports flexible output formats â JSON, XML, and HTML â making it ideal for both APIs and web applications.
Settings related to error handling are: errorformat, showerror, logerror and is explained in this page
Error in JSON format

Error in HTML format

Error in XML format

Error catching â
đĄ Usage
catch error
php
throw new \Core\Error\ErrorWrapper(Throwable | string $input, int $code = 0): void;input
â String message or Throwable object
code (optional)
â HTTP response status code
Examples:
php
// with try-catch
try{
// your logic here
}catch(\Throwable $e){
throw new \Core\Error\ErrorWrapper($e);
}
// without try-catch
undefinedFunction(); // call an undefined function or anything that cause error
throw new \Core\Error\ErrorWrapper("Error undefined function", 404);âšī¸ NOTE
If the error code doesn't represent HTTP response status codes then Error Handler will produce error 500