Skip to content

Commit

Permalink
Merge pull request #158 from bartvde/error-msg
Browse files Browse the repository at this point in the history
Show error dialog when WPS execution fails
  • Loading branch information
bartvde committed Feb 9, 2015
2 parents 427d1c4 + ba186b2 commit d53ed47
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/ng/edit/style/services/layerClassificationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

var module = angular.module('storytools.edit.style.layerClassificationService', []);

module.factory('stLayerClassificationService', function($q, $http) {
module.factory('stLayerClassificationService', function($q, $http, $modal, $sce, $log) {
return {
classify: function(layer, attribute, method, numClasses) {
if (!this.cache) {
Expand Down Expand Up @@ -81,9 +81,16 @@
service.cache[key] = response.rules;
return response.rules;
} else {
if (window.console) {
window.console.warn(response.msg);
}
$modal.open({
templateUrl: '/lib/templates/core/error-dialog.html',
controller: function($scope) {
$scope.title = 'Error';
$scope.msg = $sce.trustAsHtml(
'An error occurred when communicating with the classification ' +
'service: <br/>' + response.msg);
}
});
$log.warn(response.msg);
return [];
}
});
Expand Down
11 changes: 11 additions & 0 deletions lib/templates/core/error-dialog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div>
<div class="modal-header">
<h3 class="modal-title">{{title}}</h3>
</div>
<div class="modal-body">
<span ng-bind-html="msg"></span>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="$close()">OK</button>
</div>
</div>

0 comments on commit d53ed47

Please sign in to comment.