Permalink
Browse files

Acknowledge and report failure of API calls

  • Loading branch information...
1 parent 014de38 commit 42cd6184b7e3705805227949ea7e4790ffa2a313 @partheseas committed Oct 7, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 Library/trailer.js
View
16 Library/trailer.js
@@ -470,12 +470,20 @@ trailer.GET.preprocessors.push(
if ( i.conf.api ) {
if ( i.conf.api[ i.up ] ) {
try {
- return i.conf.api[ i.up ]( i, o, i.extra )
- } catch ( error ) {}
+ return i.conf.api[ i.up ]( i, o, i.extra )
+ } catch ( error ) {
+ console.log( "API " + i.up + " failed for " + i.url )
+ o.error( 500 )
+ return true
+ }
} else if ( i.conf.api[ i.extra ] ) {
try {
- return i.conf.api[ i.extra ]( i, o, i.up )
- } catch ( error ) {}
+ return i.conf.api[ i.extra ]( i, o, i.up )
+ } catch ( error ) {
+ console.log( "API " + i.extra + " failed for " + i.url )
+ o.error( 500 )
+ return true
+ }
}
}
},

0 comments on commit 42cd618

Please sign in to comment.