Index: trunk/extensions/UploadWizard/resources/mw.Api.js |
— | — | @@ -27,14 +27,6 @@ |
28 | 28 | |
29 | 29 | this.url = options.url; |
30 | 30 | |
31 | | - // deal with cases where we need an API proxy |
32 | | - var apiUri = new mw.Uri( this.url ); |
33 | | - var scriptUri = new mw.Uri( window.location ); |
34 | | - if ( apiUri.host !== scriptUri.host ) { |
35 | | - /* Ask mdale, his proxy was not being developed on wikimedia svn... somewhere on Kaltura servers */ |
36 | | - throw new Error( "unimplemented -- API proxy required."); |
37 | | - } |
38 | | - |
39 | 31 | var _this = this; |
40 | 32 | |
41 | 33 | /* We allow people to omit these default parameters from API requests */ |
— | — | @@ -137,10 +129,13 @@ |
138 | 130 | ajaxOptions.err( 'http-' + textStatus, { xhr: xhr, exception: exception } ); |
139 | 131 | }; |
140 | 132 | |
141 | | - /* success just means 200 OK; also check for API errors */ |
| 133 | + /* success just means 200 OK; also check for output and API errors */ |
142 | 134 | ajaxOptions.success = function( result ) { |
143 | | - if ( result.error ) { |
144 | | - ajaxOptions.err( result.error.code, result ); |
| 135 | + if ( mw.isEmpty( result ) ) { |
| 136 | + ajaxOptions.err( "empty", "OK response but empty result (check HTTP headers?)" ); |
| 137 | + } else if ( result.error ) { |
| 138 | + var code = mw.isDefined( result.error.code ) ? result.error.code : "unknown"; |
| 139 | + ajaxOptions.err( code, result ); |
145 | 140 | } else { |
146 | 141 | ajaxOptions.ok( result ); |
147 | 142 | } |