++ed by:

1 non-PAUSE user.

Konstantin S. Uvarin


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.

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.



new( $@ || 500, %options )

new( %options )

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.



Result will start with MVC::Neaf: if error was generated via die 404 or a redirect.

Otherwise it would look similar to the original -status.

make_reply( $request )

Create a Neaf-like default reply:



    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.

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.