Skip to content

Instantly share code, notes, and snippets.

@marcusramberg
Created September 25, 2010 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusramberg/596919 to your computer and use it in GitHub Desktop.
Save marcusramberg/596919 to your computer and use it in GitHub Desktop.
diff --git a/Changes b/Changes
index b3f1f2b..952bfe1 100644
--- a/Changes
+++ b/Changes
@@ -29,6 +29,7 @@ This file documents the revision history for Perl extension Mojolicious.
(vti)
- Added b function to all Mojo::Template templates.
- Added selector support to the dom method of Mojo::Message. (marcus)
+ - Make failed ojo requests warn (marcus)
- Simplified transaction pausing by replacing it with an automatism.
- Improved RFC3986 compliance of Mojo::Path. (janus)
- Improved Mojo::Server::PSGI to preload applications.
diff --git a/lib/ojo.pm b/lib/ojo.pm
index 2812998..bea99cb 100644
--- a/lib/ojo.pm
+++ b/lib/ojo.pm
@@ -47,6 +47,10 @@ sub _request {
? $client->build_form_tx(@_)
: $client->build_tx($method, @_);
$client->process($tx, sub { $tx = $_[1] });
+ # Error
+ my ($message, $code) = $tx->error;
+ print qq/Couldn't open URL "$_[0]". ($message)\n/ if $message && !$code;
+
return $tx->res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment