Skip to content

Provide self to _error #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/MediaWiki/API.pm
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ An example for the on_error configuration could be something like:

Errors are stored in $mw->{error}->{code} with more information in $mw->{error}->{details}. $mw->{error}->{stacktrace} includes
the details and a stacktrace to locate where any problems originated from (in some code which uses this module for example).
The MediaWiki::API object itself is provided to the function.

The error codes are as follows

Expand Down Expand Up @@ -900,7 +901,7 @@ sub _error {
$self->{error}->{details} = $desc;
$self->{error}->{stacktrace} = Carp::longmess($desc);

$self->{config}->{on_error}->() if (defined $self->{config}->{on_error});
$self->{config}->{on_error}->($self) if (defined $self->{config}->{on_error});

return undef;
}
Expand Down