more debug output

This commit is contained in:
Synox 2016-11-26 19:32:58 +01:00
parent ba02ed8b0f
commit 03017dfa41
2 changed files with 19 additions and 6 deletions

View file

@ -86,7 +86,7 @@ app.controller('MailboxController', ["$scope", "$interval", "$http", "$log", fun
self.loadEmailsAsync = function (username) {
$log.debug("updating mails for ", username);
$http.get(backend_url, {params: {username: username, action: "get"}})
$http.get(backend_url, {params: {username: username}})
.then(function successCallback(response) {
$log.debug("received mails for ", username);
if (response.data.mails) {
@ -95,11 +95,20 @@ app.controller('MailboxController', ["$scope", "$interval", "$http", "$log", fun
self.address = response.data.address;
self.username = response.data.username;
} else {
self.error = "There is a problem with fetching the JSON. (JSON_ERROR). Reponse: " + response.data;
self.error = {
title: "JSON_ERROR",
desc: "The JSON from the response can not be read.",
detail: response
};
$log.error(response);
}
}, function errorCallback(response) {
$log.error(response);
self.error = "There is a problem with fetching the JSON. (HTTP_ERROR). Status: " + response.status;
$log.error(response, this);
self.error = {
title: "HTTP_ERROR",
desc: "There is a problem with loading the data. (HTTP_ERROR).",
detail: response
};
});
};

View file

@ -45,8 +45,12 @@
<div class="container min-height">
<div ng-if="$ctrl.error" class="alert alert-danger" role="alert">
<p><strong>Sorry, there was a problem. </strong></p>
<p> {{$ctrl.error}} </p>
<p> Make sure the backend works corrently using the developer tools of your web browser. </p>
<p> {{$ctrl.error.desc}} </p>
<p>
<pre>{{$ctrl.error.detail|json}}</pre>
</p>
<p> If you are the developer you might want to check the developer tools console of your web
browser. </p>
</div>
<p ng-if="!$ctrl.username">