Skip to content

Commit

Permalink
added example for error event of user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 26, 2011
1 parent 8f856d5 commit 7103e85
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

2.41 2011-12-26 00:00:00
- Improved documentation.

2.40 2011-12-24 00:00:00
- Added EXPERIMENTAL JSON Pointer support. (crab)
- Improved inactivity timeouts by allowing them to be disabled.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/JSON.pm
Expand Up @@ -146,7 +146,7 @@ sub _decode_object {

# Quote
m/\G$WHITESPACE_RE"/xgc
or _exception("Expected string while parsing object");
or _exception('Expected string while parsing object');

# Key
my $key = _decode_string();
Expand All @@ -165,7 +165,7 @@ sub _decode_object {
last if m/\G$WHITESPACE_RE\}/xgc;

# Invalid character
_exception(q/Expected comma or right curly bracket while parsing object/);
_exception('Expected comma or right curly bracket while parsing object');
}

return \%hash;
Expand Down
5 changes: 5 additions & 0 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -650,6 +650,11 @@ L<Mojo::UserAgent> can emit the following events.
Emitted if an error happens that can't be associated with a transaction. Note
that this event is EXPERIMENTAL and might change without warning!
$ua->on(error => sub {
my ($ua, $err) = @_;
say "This looks bad: $err";
});
=head2 C<start>
$ua->on(start => sub {
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious.pm
Expand Up @@ -32,7 +32,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Leaf Fluttering In Wind';
our $VERSION = '2.40';
our $VERSION = '2.41';

# "These old doomsday devices are dangerously unstable.
# I'll rest easier not knowing where they are."
Expand Down Expand Up @@ -665,7 +665,7 @@ directory.
=head2 Mojolicious Artwork
Copyright (C) 2010-2011, Sebastian Riedel.
Copyright (C) 2010-2012, Sebastian Riedel.
Licensed under the CC-SA License, Version 3.0
L<http://creativecommons.org/licenses/by-sa/3.0>.
Expand Down Expand Up @@ -922,7 +922,7 @@ Zak B. Elep
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2008-2011, Sebastian Riedel.
Copyright (C) 2008-2012, Sebastian Riedel.
This program is free software, you can redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
Expand Down

0 comments on commit 7103e85

Please sign in to comment.