Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0bae0979

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 0bae09796539d19ca18f6567dac468271404e7c3
  • Vorgänger ea974a5a
  • Nachfolger 9b3133b3

RDBO: Exceptions in before_*/after_*-Hooks bubblen

Unterschiede anzeigen:

SL/DB/Object.pm
134 134

  
135 135
  my ($result, $exception);
136 136
  my $worker = sub {
137
    SL::DB::Object::Hooks::run_hooks($self, 'before_save');
138 137
    $exception = $EVAL_ERROR unless eval {
138
      SL::DB::Object::Hooks::run_hooks($self, 'before_save');
139 139
      $result = $self->SUPER::save(@args);
140
      SL::DB::Object::Hooks::run_hooks($self, 'after_save', $result);
140 141
      1;
141 142
    };
142
    SL::DB::Object::Hooks::run_hooks($self, 'after_save', $result);
143 143

  
144 144
    return $result;
145 145
  };
......
156 156

  
157 157
  my ($result, $exception);
158 158
  my $worker = sub {
159
    SL::DB::Object::Hooks::run_hooks($self, 'before_delete');
160 159
    $exception = $EVAL_ERROR unless eval {
160
      SL::DB::Object::Hooks::run_hooks($self, 'before_delete');
161 161
      $result = $self->SUPER::delete(@args);
162
      SL::DB::Object::Hooks::run_hooks($self, 'after_delete', $result);
162 163
      1;
163 164
    };
164
    SL::DB::Object::Hooks::run_hooks($self, 'after_delete', $result);
165 165

  
166 166
    return $result;
167 167
  };

Auch abrufbar als: Unified diff