Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

throwable::error(3pm) [debian man page]

Throwable::Error(3pm)					User Contributed Perl Documentation				     Throwable::Error(3pm)

NAME
Throwable::Error - an easy-to-use class for error objects VERSION
version 0.102080 SYNOPSIS
package MyApp::Error; use Moose; extends 'Throwable::Error'; has execution_phase => ( is => 'ro', isa => 'MyApp::Phase', default => 'startup', ); ...and in your app... MyApp::Error->throw("all communications offline"); # or... MyApp::Error->throw({ message => "all communications offline", phase => 'shutdown', }); DESCRIPTION
Throwable::Error is a base class for exceptions that will be thrown to signal errors and abort normal program flow. Throwable::Error is an alternative to Exception::Class, the features of which are largely provided by the Moose object system atop which Throwable::Error is built. Throwable::Error performs the Throwable and StackTrace::Auto roles. That means you can call "throw" on it to create and throw n error object in one call, and that every error object will have a stack trace for its creation. ATTRIBUTES
message This attribute must be defined and must contain a string describing the error condition. This string will be printed at the top of the stack trace when the error is stringified. stack_trace This attribute, provided by StackTrace::Auto, will contain a stack trace object guaranteed to respond to the "as_string" method. For more information about the stack trace and associated behavior, consult the StackTrace::Auto docs. METHODS
as_string This method will provide a string representing the error, containing the error's message followed by the its stack trace. AUTHORS
o Ricardo SIGNES <rjbs@cpan.org> o Florian Ragwitz <rafl@debian.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.10.1 2010-07-27 Throwable::Error(3pm)

Check Out this Related Man Page

Plack::Middleware::HTTPExceptions(3pm)			User Contributed Perl Documentation		    Plack::Middleware::HTTPExceptions(3pm)

NAME
Plack::Middleware::HTTPExceptions - Catch HTTP exceptions SYNOPSIS
use HTTP::Exception; my $app = sub { # ... HTTP::Exception::500->throw; }; builder { enable "HTTPExceptions", rethrow => 1; $app; }; DESCRIPTION
Plack::Middleware::HTTPExceptions is a PSGI middleware component to catch exceptions from applications that can be translated into HTTP status codes. Your application is supposed to throw an object that implements a "code" method which returns the HTTP status code, such as 501 or 404. This middleware catches them and creates a valid response out of the code. If the "code" method returns a code that is not an HTTP redirect or error code (3xx, 4xx, or 5xx), the exception will be rethrown. The exception object may also implement "as_string" or overload stringification to represent the text of the error. The text defaults to the status message of the error code, such as Service Unavailable for 503. Finally, the exception object may implement "as_psgi", and the result of this will be returned directly as the PSGI response. If the code is in the 3xx range and the exception implements the 'location' method (HTTP::Exception::3xx does), the Location header will be set in the response, so you can do redirects this way. There are CPAN modules HTTP::Exception and HTTP::Throwable, and they are perfect to throw from your application to let this middleware catch and display, but you can also implement your own exception class to throw. If the thrown exception is not an object that implements either a "code" or an "as_psgi" method, a 500 error will be returned. Alternatively, you can pass a true value for the "rethrow" parameter for this middleware, and the exception will instead be rethrown. This is enabled by default when "PLACK_ENV" is set to "development", so that the StackTrace middleware can catch it instead. AUTHOR
Tatsuhiko Miyagawa SEE ALSO
paste.httpexceptions HTTP::Exception HTTP::Throwable perl v5.14.2 2011-06-22 Plack::Middleware::HTTPExceptions(3pm)
Man Page