The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Record::Serialize::Error - Error objects

VERSION

version 0.17

SYNOPSIS

  use Data::Record::Serialize::Error -all;
  use Data::Record::Serialize::Error { errors =>
  [ qw( param
        connect
        schema
        create
        insert
   )] }, -all;

DESCRIPTION

For the user of Data::Record::Serialize

Most errors result in exception objects being thrown, typically in the Data::Record::Serialize::Error hierarchy. The exception objects will stringify to an appropriate error message. Additional payload data may be returned as well (see the documentation for the individual modules which throw exceptions). The objects are derived from failures and have the attributes documented in "Attributes" in failures.

For the developer

This module organizes Data::Record::Serialize errors based upon custom::failures. It uses Exporter::Shiny. The global option nnerrors may be used to construct a set of error classes. errors is passed an array of error names; if they begin with :: they are relative to Data::Record::Serialize::Error, otherwise they are relative to the Error sub-hierarchy under the calling package.

For example,

  package Data::Record::Serialize::Bar;
  use Data::Record::Serialize::Error { errors => [ '::foo', 'foo' ] };

will construct error classes Data::Record::Serialize::Error::foo and Data::Record::Serialize::Bar::Error::foo;

Error Class Names

Names (passed either during module import or to the "error" subroutine) are converted to fully qualified class names via the following:

  • if a name begins with :: it is relative to Data::Record::Serialize::Error

  • otherwise it is relative to the Error sub-hierarchy under the calling package.

For example, in

  package Data::Record::Serialize::Bar;
  use Data::Record::Serialize::Error { errors => [ '::foo', 'foo' ] };

  error( '::foo', @stuff );
  error( 'foo', @stuff );

::foo will be converted to Data::Record::Serialize::Error::foo and foo to Data::Record::Serialize::Bar::Error::foo.

ATTRIBUTES

msg

payload

trace

See "Attributes" in failures.

SUBROUTINES

error

  error( $error_class, @_ );

Throw an error. $error_class is converted to a fully qualified class name; see "Error Class Names". The remaining parameters are passed directly to the failures throw method (see "Throwing failures" in failures).

BUGS AND LIMITATIONS

You can make new bug reports, and view existing ones, through the web interface at https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Record-Serialize.

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Diab Jerius <djerius@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007