Use HTTP status 422 for failures

This commit is contained in:
Kane York 2015-07-15 12:51:33 -07:00
parent 6a61f694ee
commit 5156ab1f72
2 changed files with 7 additions and 3 deletions

View File

@ -182,9 +182,13 @@ export default Ember.ArrayController.extend({
} }
self.set('showResults', true); self.set('showResults', true);
}).catch(function(result) { }).catch(function(err) {
self.set('showResults', false); self.set('showResults', false);
self.set('results', result); if (err.jqXHR && err.jqXHR.status === 422 && err.jqXHR.responseJSON) {
self.set('results', err.jqXHR.responseJSON);
} else {
popupAjaxError(err);
}
}).finally(function() { }).finally(function() {
self.set('loading', false); self.set('loading', false);
}); });

View File

@ -720,7 +720,7 @@ SQL
render json: { render json: {
success: false, success: false,
errors: [err_msg] errors: [err_msg]
} }, status: 422
else else
pg_result = result[:pg_result] pg_result = result[:pg_result]
cols = pg_result.fields cols = pg_result.fields