Skip to content

Commit

Permalink
#63 Fix the error handling when inserting an observable
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Dec 16, 2016
1 parent 837a594 commit f852166
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion ui/app/scripts/controllers/case/ObservableCreationCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,16 @@
};

$scope.getFailedObservables = function(failures) {
if(!_.isArray(failures)) {
failures = [failures];
}

return _.map(failures, function(observable) {
return {
data: observable.object.data,
type: observable.type
};
});
});
};

$scope.handleSaveSuccess = function(response) {
Expand Down
5 changes: 3 additions & 2 deletions ui/app/views/partials/observables/creation/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<tbody>
<tr ng-repeat="o in failedObservables">
<td class="wrap">{{o.data | fang}}</td>
<td class="nowrap" ng-switch="o.type">
<span ng-switch-when="CONFLICT">Already exists</span>
<td class="nowrap" ng-switch="o.type">
<span ng-switch-when="CreateError">Already exists</span>
<span ng-switch-when="ConflictError">Already exists</span>
<span ng-switch-when="AttributeError">Format error</span>
<span ng-switch-default>Unexpected error</span>
</td>
Expand Down

0 comments on commit f852166

Please sign in to comment.