Changeset a75ca74156bfac8b92c3b87b2c120d446dcf5345
- Timestamp:
- 11/06/09 22:32:54 (10 months ago)
- Author:
- Stephen Bennett <spb@…>
- Parents:
- 20b3fcc6b52236b404b7d7aaf1517f57be3f84a2
- Children:
- 41a47f14b962f658a0805dd7d3183fd9cb2d8728
- git-committer:
- Stephen Bennett <spb@exherbo.org> / 2009-11-06T22:32:54Z+0000
- Message:
-
Translate DBIC exceptions from inserting channel namespaces to something more intelligible, where possible
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r71bc43c
|
ra75ca74
|
|
| 3 | 3 | use warnings; |
| 4 | 4 | use base 'DBIx::Class'; |
| | 5 | |
| | 6 | use TryCatch; |
| 5 | 7 | |
| 6 | 8 | __PACKAGE__->load_components('Core'); |
| … |
… |
|
| 10 | 12 | __PACKAGE__->belongs_to('group', 'GMS::Schema::Result::Group', 'group_id'); |
| 11 | 13 | |
| | 14 | sub insert { |
| | 15 | my $self = shift; |
| | 16 | try { |
| | 17 | return $self->next::method(@_); |
| | 18 | } |
| | 19 | catch (DBIx::Class::Exception $e) { |
| | 20 | if ("$e" =~ /unique_channel_ns/) { |
| | 21 | die GMS::Exception->new("The channel namespace " . $self->namespace . |
| | 22 | " has already been claimed."); |
| | 23 | } else { |
| | 24 | die $e; |
| | 25 | } |
| | 26 | } |
| | 27 | } |
| | 28 | |
| 12 | 29 | 1; |