summaryrefslogtreecommitdiff
path: root/js/codeq/profile.js
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-03-25 16:35:57 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-03-30 13:09:29 +0200
commit5b03ea193c1927305fc99b93307b6c74bde0d84d (patch)
tree2a4e991e7ed7913d535e9b42c5daf6c91c9a68fa /js/codeq/profile.js
parentba9d5eb671997a3a7b82eeb3eb04c0a3e5c3a966 (diff)
Clean up a few error functions
Diffstat (limited to 'js/codeq/profile.js')
-rw-r--r--js/codeq/profile.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/js/codeq/profile.js b/js/codeq/profile.js
index 79a9bf5..8d26c85 100644
--- a/js/codeq/profile.js
+++ b/js/codeq/profile.js
@@ -44,7 +44,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
$('#disabled').css('display', 'none');
codeq.comms.getUserStat()
.then(function (data) {
- if (data.code !== 0) throw new Error('GetUserStat failed, code: ' + data.code + ', message: ' + data.message);
+ if (data.code !== 0) {
+ throw new Error(data.message);
+ }
data = data.stat;
var columns = ['language', 'problem_group', 'problems_count', 'done', 'in_progress'],
@@ -74,9 +76,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
$('#profile-stats').html(items)
})
- .fail(function (reason) {
- codeq.log.error('GetUserStat failed: ' + reason, reason);
- alert('GetUserStat failed: ' + reason);
+ .fail(function (error) {
+ var message = 'Could not retrieve stats: ' + error.message;
+ codeq.log.error(message, error);
+ alert(message);
})
.done();
},