frontend: console.log is not a good way to handle errors
This commit is contained in:
parent
07cea2e04a
commit
0414c392bf
2 changed files with 5 additions and 2 deletions
|
@ -221,6 +221,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
|
||||
$scope.hsubmit = function(hint) {
|
||||
hint.submitted = true;
|
||||
$scope.hinterror = null;
|
||||
$http({ url: "/openhint/" + $rootScope.current_exercice, method: "POST", data: { id: hint.id } }).then(function(response, status, header, config) {
|
||||
var checkDiffHint = function() {
|
||||
$http.get("/my.json").then(function(response) {
|
||||
|
@ -239,8 +240,8 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
};
|
||||
checkDiffHint();
|
||||
}, function(response, status, header, config) {
|
||||
$scope.hinterror = response.data.errmsg;
|
||||
hint.submitted = false;
|
||||
console.error(response.data.errmsg);
|
||||
});
|
||||
};
|
||||
})
|
||||
|
@ -488,7 +489,6 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$location.url("/");
|
||||
}, function(response) {
|
||||
$scope.messageClass = {"text-danger": true};
|
||||
console.log(response);
|
||||
if (response.data && response.data.errmsg)
|
||||
$scope.message = response.data.errmsg;
|
||||
else
|
||||
|
|
|
@ -56,6 +56,9 @@
|
|||
<div class="card-header bg-info text-white">
|
||||
<span class="glyphicon glyphicon-lamp" aria-hidden="true"></span> Indices
|
||||
</div>
|
||||
<div class="card-body" ng-if="hinterror">
|
||||
<div class="card-text text-danger" ng-bind="hinterror"></div>
|
||||
</div>
|
||||
<div class="list-group">
|
||||
<a target="_self" class="list-group-item text-light" ng-repeat="hint in my.exercices[current_exercice].hints" ng-href="{{ hint.file }}">
|
||||
<button type="button" ng-click="hsubmit(hint)" class="float-right btn btn-info" ng-if="!(hint.content || hint.file)" ng-class="{disabled: hint.submitted}"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span> Débloquer</button>
|
||||
|
|
Reference in a new issue