Permalink
Browse files

Replace a try/catch with an eval in a frequently used codepath

  • Loading branch information...
1 parent fddec21 commit 1eef8091e3730d283c042120aac356355f0d25d7 @clintongormley committed Nov 15, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/Elastic/Model/Role/Doc.pm
View
11 lib/Elastic/Model/Role/Doc.pm
@@ -117,13 +117,14 @@ sub _inflate_doc {
or return bless( $self, 'Elastic::Model::Deleted' )->croak;
$self->_can_inflate(0);
- try {
+ eval {
$self->model->inflate_object( $self, $source );
- }
- catch {
+ 1
+ } or do {
+ my $error = $@;
$self->_can_inflate(1);
- die $_;
- };
+ die $error
+ }
}
#===================================

0 comments on commit 1eef809

Please sign in to comment.