diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-10-02 20:22:05 +0200 |
---|---|---|
committer | dklawren <dklawren@users.noreply.github.com> | 2018-10-02 20:22:05 +0200 |
commit | 62412db14081dd66cd5b2701b598b5af9eb31528 (patch) | |
tree | 7e84a852449e530a0b0bae5ef581eace63c81e83 /Bugzilla/Error.pm | |
parent | abe9b579f25120898b714d4b73343918169d48ac (diff) | |
download | bugzilla-62412db14081dd66cd5b2701b598b5af9eb31528.tar.gz bugzilla-62412db14081dd66cd5b2701b598b5af9eb31528.tar.xz |
add helpers for handling logins and error handling
Diffstat (limited to 'Bugzilla/Error.pm')
-rw-r--r-- | Bugzilla/Error.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index f932294b0..70430d40d 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -20,6 +20,8 @@ our @EXPORT = qw( ThrowCodeError ThrowTemplateError ThrowUserError ThrowErrorPag use Bugzilla::Constants; use Bugzilla::WebService::Constants; use Bugzilla::Util; +use Bugzilla::Error::User; +use Bugzilla::Error::Code; use Carp; use Data::Dumper; @@ -40,7 +42,6 @@ sub _in_eval { sub _throw_error { my ($name, $error, $vars, $logfunc) = @_; $vars ||= {}; - $vars->{error} = $error; # Make sure any transaction is rolled back (if supported). # If we are within an eval(), do not roll back transactions as we are @@ -48,6 +49,15 @@ sub _throw_error { my $dbh = eval { Bugzilla->dbh }; $dbh->bz_rollback_transaction() if ($dbh && $dbh->bz_in_transaction() && !_in_eval()); + if (Bugzilla->error_mode == ERROR_MODE_MOJO) { + my ($type) = $name =~ /^global\/(user|code)-error/; + my $class = $type ? 'Bugzilla::Error::' . ucfirst($type) : 'Mojo::Exception'; + my $e = $class->new($error)->trace(2); + $e->vars($vars) if $e->can('vars'); + CORE::die $e->inspect; + } + + $vars->{error} = $error; my $template = Bugzilla->template; my $message; |