The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

File::DataClass::Exception - Consumes the base class and applies roles

Synopsis

   use File::DataClass::Functions qw(throw);
   use Try::Tiny;

   sub some_method {
      my $self = shift;

      try   { this_will_fail }
      catch { throw $_ };
   }

   # OR
   use File::DataClass::Exception;

   sub some_method {
      my $self = shift;

      eval { this_will_fail };
      File::DataClass::Exception->throw_on_error;
   }

   # THEN
   try   { $self->some_method() }
   catch { warn $_."\n\n".$_->stacktrace."\n" };

Version

This documents version v0.19.$Rev: 1 $ of File::DataClass::Exception

Description

An exception class that supports error messages with placeholders, a "throw" in File::DataClass::Exception::TraitFor::Throwing method with automatic re-throw upon detection of self, conditional throw if an exception was caught and a simplified stacktrace

Error objects are overloaded to stringify to the full error message plus a leader

Applies exception roles to the exception base class File::DataClass::Exception::Base. See "Dependencies" for the list of roles that are applied

Configuration and Environment

The File::DataClass::Exception->Ignore class attribute is an array ref of methods whose presence should be ignored by the error message leader. It does the 'Array' trait where push implements the ignore_class method

Subroutines/Methods

is_one_of_us

   $bool = $class->is_one_of_us( $string_or_exception_object_ref );

Class method which detects instances of this exception class

Diagnostics

None

Dependencies

namespace::autoclean
File::DataClass::Exception::Base
File::DataClass::Exception::TraitFor::Throwing
File::DataClass::Exception::TraitFor::TracingStacks
File::DataClass::Exception::TraitFor::ErrorLeader
Moose

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Acknowledgements

Larry Wall - For the Perl programming language

Author

Peter Flanigan, <pjfl@cpan.org>

License and Copyright

Copyright (c) 2013 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE