| 1 | package ShardedKV::Error; | ||
| 2 | 3 | $ShardedKV::Error::VERSION = '0.20'; | |
| 3 | 3 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | extends 'Throwable::Error'; | |
| 5 | |||
| 6 | #ABSTRACT: Provides an error class for managing exceptions | ||
| 7 | |||
| 8 | |||
| 9 | 3 | has storage_type => ( | |
| 10 | is => 'ro', | ||
| 11 | isa => Moose::Util::TypeConstraints::enum([qw/redis mysql/]), | ||
| 12 | required => 1, | ||
| 13 | ); | ||
| 14 | |||
| 15 | |||
| 16 | 3 | has endpoint => ( | |
| 17 | is => 'ro', | ||
| 18 | isa => 'Str', | ||
| 19 | required => 1, | ||
| 20 | ); | ||
| 21 | |||
| 22 | 3 | 1; | |
| 23 | 3 | __PACKAGE__->meta->make_immutable(inline_constructor => 0); | |
| 24 | |||
| 25 | =pod | ||
| 26 | |||
| 27 | =head1 NAME | ||
| 28 | |||
| 29 | ShardedKV::Error - Provides an error class for managing exceptions | ||
| 30 | |||
| 31 | =head1 VERSION | ||
| 32 | |||
| 33 | version 0.20 | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | ShardedKV::Error provides a base error class for exceptions that occur in storage backends. Since ShardedKV abstracts away which storage backend is in use, this class provides a couple of attributes that help identify problem endpoints and storage types. There are three subclasses that also identify what sort of operation failed: L<ShardedKV::Error::ConnectFail>, L<ShardedKV::Error::ReadFail>, L<ShardedKV::Error::WriteFail>. | ||
| 38 | |||
| 39 | =head1 PUBLIC ATTRIBUTES | ||
| 40 | |||
| 41 | =head2 storage_type | ||
| 42 | |||
| 43 | (is: ro, isa: enum(redis, mysql), required) | ||
| 44 | |||
| 45 | storage_type allows for consumers of ShardedKV to know what threw the exception | ||
| 46 | without knowing which storage backend was in use. Since we only support two | ||
| 47 | types, it is sufficient to simply have an enum for those two types. | ||
| 48 | |||
| 49 | =head2 endpoint | ||
| 50 | |||
| 51 | (is: ro, isa: Str, required) | ||
| 52 | |||
| 53 | endpoint allows for consumers of ShardedKV to know to which component the storage backend was communicating. endpoint maybe whatever identifier the storage backend requires. So please consider this a free-form string and check the documentation for the given storage backend module for what endpoint means. | ||
| 54 | |||
| 55 | =head1 AUTHORS | ||
| 56 | |||
| 57 | =over 4 | ||
| 58 | |||
| 59 | =item * | ||
| 60 | |||
| 61 | Steffen Mueller <smueller@cpan.org> | ||
| 62 | |||
| 63 | =item * | ||
| 64 | |||
| 65 | Nick Perez <nperez@cpan.org> | ||
| 66 | |||
| 67 | =item * | ||
| 68 | |||
| 69 | Damian Gryski <dgryski@cpan.org> | ||
| 70 | |||
| 71 | =back | ||
| 72 | |||
| 73 | =head1 COPYRIGHT AND LICENSE | ||
| 74 | |||
| 75 | This software is copyright (c) 2013 by Steffen Mueller. | ||
| 76 | |||
| 77 | This is free software; you can redistribute it and/or modify it under | ||
| 78 | the same terms as the Perl 5 programming language system itself. | ||
| 79 | |||
| 80 | =cut | ||
| 81 | |||
| 82 | __END__ | ||