MVC::Neaf::Exception - Exception class for Not Even A Framework.
Currently internal signalling or MVC::Neaf is based on the exception mechanism. To avoid collisions with user's exceptions or Perl errors, these internal exceptions are blessed into this class.
Please see the neaf_err() function in MVC::Neaf.
By convention, die nnn and die MVC::Neaf::Exception-new( nnn )> will be treated exactly the same by Neaf.
die nnn
die MVC::Neaf::Exception-
CAUTION. This file is mostly used internally by Neaf and may change with little to no warning. Please file a bug/feature request demanding a more stable interface if you plan to rely on it.
CAVEAT EMPTOR.
Returns a new exception object.
%options may include any keys as well as some Neaf-like control keys:
-status - alias for first argument. If starts with 3 digits, will result in a "http error page" exception, otherwise is reset to 500 and reason is updated.
-reason - details about what happened
-location - indicates a redirection
-sudden - this was not an expected error (die 404 or redirect) This will automatically turn on if -status cannot be parsed.
-file - where error happened
-line - where error happened
-nocaller - don't try to determine error origin via caller
Return error code.
Tells whether error was unexpected.
EXPERIMENTAL. Name and meaning subject to change.
Stringify.
Result will start with MVC::Neaf: if error was generated via die 404 or a redirect.
MVC::Neaf:
die 404
Otherwise it would look similar to the original -status.
Create a Neaf-like default reply:
{"status":400,"req_id":"FOOB4RED"}
Or
See $location
if redirect.
Returns error message that was expected to cause the error.
Return " at /foo/bar line 42" suffix, if both file and line are available. Empty string otherwise.
Converts exception to JSON, so that it doesn't frighten View::JS.
Copyright 2016-2017 Konstantin S. Uvarin khedin@cpan.org.
khedin@cpan.org
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install MVC::Neaf, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MVC::Neaf
CPAN shell
perl -MCPAN -e shell install MVC::Neaf
For more information on module installation, please visit the detailed CPAN module installation guide.