NAME

Lim::Error - Encapsulate an error within Lim

VERSION

See Lim for version.

SYNOPSIS

    use Lim::Error;

    $error = Lim::Error->new('This is a simple error');

METHODS

$error = Lim::Error->new(key => value...)

Create a new Lim::Error object.

code => 500

Specify the error code, used in HTTP responses as well as RPC protocols.

message => $message

Specify the error message.

module => $module

Specify the module that created this error, if its a blessed object the ref() of that object will be used.

$error->set($hash_ref)

Populate an error object from a hash reference.

$error->code

Return the code of the error.

$error->set_code($code)

Set the error code to $code.

$error->message

Return the message of the error.

$error->set_message($message)

Set the error message to $message

$error->module

Return the module name of the error.

$error->set_module($module_name)

Set the module name of the error, this can not take blessed objects.

$hash_ref = $error->TO_JSON

Returns a hash reference describing the error, this is to support passing objects to JSON::XS.

$string = $error->toString

Returns a string that describes the error.

AUTHOR

Jerry Lundström, <lundstrom.jerry at gmail.com>

BUGS

Please report any bugs or feature requests to https://github.com/jelu/lim/issues.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Lim::Error

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012-2013 Jerry Lundström.

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.