Skip to content

Commit

Permalink
feat(listen): Added user visible error messages for API failures
Browse files Browse the repository at this point in the history
Closes #241. Affects update/save/delete operations for audio events and taggings
  • Loading branch information
atruskie committed Oct 15, 2015
1 parent 824a3f4 commit ce1f435
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/app/listen/listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ angular.module("bawApp.listen", ["decipher.tags", "ui.bootstrap.typeahead"])
"UserProfileEvents",
"Bookmark",
"moment",
"growl",
/**
* The listen controller.
* @param $scope
Expand Down Expand Up @@ -53,7 +54,7 @@ angular.module("bawApp.listen", ["decipher.tags", "ui.bootstrap.typeahead"])
function ListenCtrl(
$scope, $resource, $location, $routeParams, $route, $q, paths, constants, $url, _, ngAudioEvents,
AudioRecording, MediaService, Media, AudioEvent, Tag, TagModel, Taggings, Site, Project, UserProfile,
UserProfileEvents, Bookmark, moment) {
UserProfileEvents, Bookmark, moment, growl) {


const ChunkDurationSettings = constants.listen.chunkDurationSeconds;
Expand Down Expand Up @@ -632,6 +633,7 @@ angular.module("bawApp.listen", ["decipher.tags", "ui.bootstrap.typeahead"])
},
function error(response) {
console.error("Tagging creation failed", response);
growl.error("Adding a tag to an annotation has failed. Please refresh the page. If you see this message often please let us know.");
});
});
$scope.$on("decipher.tags.addfailed", function (event) {
Expand Down Expand Up @@ -672,6 +674,7 @@ angular.module("bawApp.listen", ["decipher.tags", "ui.bootstrap.typeahead"])
},
function error(response) {
console.error("Tagging creation failed", response);
growl.error("Removing a tag from an annotation has failed. Please refresh the page. If you see this message often please let us know.");
}
)
;
Expand Down
12 changes: 11 additions & 1 deletion src/components/directives/bawAnnotationViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ bawds.directive("bawAnnotationViewer",
"AudioEvent",
"Tag",
"lodash",
function (paths, unitConverter, AudioEvent, Tag, _) {
"growl",
function (paths, unitConverter, AudioEvent, Tag, _, growl) {

/**
* Create an watcher for an audio event model.
Expand Down Expand Up @@ -261,6 +262,15 @@ bawds.directive("bawAnnotationViewer",
},
function error(response) {
console.error("AnnotationEditor:modelUpdatesServer: " + action + " FAILURE", response);



if (method === "update" && response.status === 404) {
growl.warning("The last annotation delete may not have worked. Try refreshing this page. If you see this message often please let us know.", {ttl: 5000});
}
else {
growl.error("The last annotation save/update has failed. Please refresh the page. If you see this message often please let us know.");
}
});
};
};
Expand Down

0 comments on commit ce1f435

Please sign in to comment.