Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0281b86d

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 0281b86dc6c14910b263e7771673599544973616
  • Vorgänger 8836016b
  • Nachfolger b3f35113

DB-Object-Hooks: bei Exception in Hook auch Objekttyp in Exception-Text aufnehmen

Unterschiede anzeigen:

SL/DB/Object/Hooks.pm
44 44

  
45 45
  foreach my $sub (@{ ( $hooks{$when} || { })->{ ref($object) } || [ ] }) {
46 46
    my $result = ref($sub) eq 'CODE' ? $sub->($object, @args) : $object->call_sub($sub, @args);
47
    die SL::X::DBHookError->new(when   => $when,
48
                                hook   => (ref($sub) eq 'CODE' ? '<anonymous sub>' : $sub),
49
                                object => $object)
47
    die SL::X::DBHookError->new(when        => $when,
48
                                hook        => (ref($sub) eq 'CODE' ? '<anonymous sub>' : $sub),
49
                                object      => $object,
50
                                object_type => ref($object))
50 51
      if !$result;
51 52
  }
52 53
}
SL/X.pm
5 5
use Exception::Lite qw(declareExceptionClass);
6 6

  
7 7
declareExceptionClass('SL::X::FormError');
8
declareExceptionClass('SL::X::DBHookError', [ '%s hook \'%s\' failed', qw(when hook object) ]);
8
declareExceptionClass('SL::X::DBHookError', [ '%s hook \'%s\' for object type \'%s\' failed', qw(when hook object_type object) ]);
9 9

  
10 10
1;

Auch abrufbar als: Unified diff