From 382b81a6648f06a1f0b7545ad140d17d2a2f53d0 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 27 Jul 2017 16:30:15 +0200 Subject: [PATCH] [fix] Correctly handle error 500 (#166) * [fix] Correctly handle error 500 * [fix] Use 'em' instead of 'emph' --- src/js/yunohost/helpers.js | 7 +++++++ src/locales/en.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index bf41c86f..98fe5236 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -133,6 +133,13 @@ c.redirect('#/login'); } } + // 500 + else if (xhr.status == 500) { + error_log = JSON.parse(xhr.responseText); + error_log.route = error_log.route.join(' ') + '\n'; + error_log.arguments = JSON.stringify(error_log.arguments); + c.flash('fail', y18n.t('internal_exception', [error_log.route, error_log.arguments, error_log.traceback])); + } // 502 Bad gateway means API is down else if (xhr.status == 502) { c.flash('fail', y18n.t('api_not_responding')); diff --git a/src/locales/en.json b/src/locales/en.json index 44786813..d7ebf65f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -159,6 +159,7 @@ "installed_apps": "Installed apps", "installing": "Installing", "interface": "Interface", + "internal_exception": "Yunohost encountered an internal error :/
Really sorry about that.
You should look for help on the forum or the chat to fix the situation, or report the bug on the bugtracker.

The following information might be useful for the person helping you :

Action

%s%s

Traceback

%s
", "io": "I/O", "ipv4": "IPv4", "ipv6": "IPv6", @@ -345,4 +346,3 @@ "install_community_appslists_warning" : "Note that these applications packages are not official and not maintained by the YunoHost team.
Installing these applications is at your own risk and could break your system.", "install_custom_app_appslists_info" : "Note that you can use alternative applications lists to install some other apps maintained by the YunoHost community." } -