Permalink
Browse files

Introduce add_error() and use it for new entries

Currently it shows an alert and manages to get
the right message whether we got HTTP error or
an application level one.
  • Loading branch information...
1 parent 976c894 commit 95f496774e23cf31b0a410af390c4a842fea79a6 @nb nb committed Jul 4, 2012
Showing with 11 additions and 0 deletions.
  1. +1 −0 js/liveblog-publisher.js
  2. +10 −0 js/liveblog.js
View
@@ -49,6 +49,7 @@
}
liveblog.publisher.insert_entry_error = function( data ) {
+ liveblog.add_error( data );
liveblog.publisher.enable_posting_interface();
liveblog.publisher.hide_spinner();
}
View
@@ -210,6 +210,16 @@ var liveblog = {};
liveblog.success_callback = function() {}
liveblog.error_callback = function() {}
+ liveblog.add_error = function( data ) {
+ // TODO: show errors in a box near the nag
+ // TODO: throtle errors
+ console.log(data);
+ if ( data.message )
+ alert( 'Error: ' + data.message );
+ else if ( data.status && data.statusText )
+ alert( 'Error ' + data.status + ': ' + data.statusText );
+ }
+
// Initialize everything!
$( document ).ready( liveblog.init );

0 comments on commit 95f4967

Please sign in to comment.