Skip to content

Commit

Permalink
improved error for queryform
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Oct 25, 2016
1 parent f0fba60 commit e391111
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions web/client/reducers/queryform.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,24 @@ function queryform(state = initialState, action) {
})})});
}*/
case ZONE_SEARCH_ERROR: {
let error;
return assign({}, state, {spatialField: assign({}, state.spatialField, {zoneFields: state.spatialField.zoneFields.map((field) => {
if (field.id === action.id) {
let error = typeof action.error !== "object" ? action.error : {
status: action.error.status,
statusText: action.error.statusText,
data: action.error.data
};
if (typeof action.error !== "object") {
if (action.error.status && action.error.statusText && action.error.data) {
error = {
status: action.error.status,
statusText: action.error.statusText,
data: action.error.data
};
} else {
error = {
message: action.error.message || "unknown error"
};
}
} else {
error = action.error;
}
return assign({}, field, {
error: error,
busy: false
Expand Down

0 comments on commit e391111

Please sign in to comment.