diff --git a/src/js/index.js b/src/js/index.js index 7d9e6e0eb..86f4e06df 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -190,6 +190,25 @@ var RSTATES ={ RUNNING: 'running', STOPPED: 'stopped' }; +var ERROR = { + ACCESS_DENIED: 'Access Denied', + ALREADY_EXISTS: 'Already Exists', + BAD_FIELD: 'Bad Field', + COLLECTD_ERROR: 'Collectd Error', + CONFLICT: 'Conflict', + DATABASE_ERROR: 'Database Error', + DNS_ERROR: 'DNS Error', + DOCKER_ERROR: 'Docker Error', + EXTERNAL_ERROR: 'External Error', + FS_ERROR: 'FileSystem Error', + INTERNAL_ERROR: 'Internal Error', + LOGROTATE_ERROR: 'Logrotate Error', + NETWORK_ERROR: 'Network Error', + NOT_FOUND: 'Not found', + REVERSEPROXY_ERROR: 'ReverseProxy Error', + TASK_ERROR: 'Task Error', + UNKNOWN_ERROR: 'Unknown Error' // only used for portin, +}; app.filter('installError', function () { return function (app) { @@ -397,34 +416,18 @@ app.filter('taskName', function () { }); app.filter('errorSuggestion', function () { - // from boxerror.js - var ACCESS_DENIED = 'Access Denied'; - var ALREADY_EXISTS = 'Already Exists'; - var BAD_FIELD = 'Bad Field'; - var COLLECTD_ERROR = 'Collectd Error'; - var CONFLICT = 'Conflict'; - var DATABASE_ERROR = 'Database Error'; - var DNS_ERROR = 'DNS Error'; - var DOCKER_ERROR = 'Docker Error'; - var EXTERNAL_ERROR = 'External Error'; - var FS_ERROR = 'FileSystem Error'; - var INTERNAL_ERROR = 'Internal Error'; - var LOGROTATE_ERROR = 'Logrotate Error'; - var NETWORK_ERROR = 'Network Error'; - var NOT_FOUND = 'Not found'; - var REVERSEPROXY_ERROR = 'ReverseProxy Error'; - var TASK_ERROR = 'Task Error'; - var UNKNOWN_ERROR = 'Unknown Error'; // only used for porting - return function (error) { switch (error.reason) { - case COLLECTD_ERROR: return 'Check if collectd is running on the server'; - case DATABASE_ERROR: return 'Check if MySQL database is running on the server'; - case DOCKER_ERROR: return 'Check if docker is running on the server'; - case DNS_ERROR: return 'Check if the DNS service of the domain is running'; - case LOGROTATE_ERROR: return 'Check if logrotate is running on the server'; - case NETWORK_ERROR: return 'Check if there are any network issues on the server'; - case REVERSEPROXY_ERROR: return 'Check if nginx is running on the server'; + case ERROR.ACCESS_DENIED: + if (error.domain) return 'Check the DNS credentials of ' + error.domain.domain + ' in the Domains & Certs view'; + return ''; + case ERROR.COLLECTD_ERROR: return 'Check if collectd is running on the server'; + case ERROR.DATABASE_ERROR: return 'Check if MySQL database is running on the server'; + case ERROR.DOCKER_ERROR: return 'Check if docker is running on the server'; + case ERROR.DNS_ERROR: return 'Check if the DNS service of the domain is running'; + case ERROR.LOGROTATE_ERROR: return 'Check if logrotate is running on the server'; + case ERROR.NETWORK_ERROR: return 'Check if there are any network issues on the server'; + case ERROR.REVERSEPROXY_ERROR: return 'Check if nginx is running on the server'; default: return ''; } }; diff --git a/src/views/appstore.js b/src/views/appstore.js index d18f2ff5d..d1d5a5043 100644 --- a/src/views/appstore.js +++ b/src/views/appstore.js @@ -181,8 +181,16 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca if (!data.overwriteDns) { if (result.error || result.needsOverwrite) { - $scope.appInstall.needsOverwrite = true; - $scope.appInstall.error.location = result.error ? result.error.message : 'DNS Record already exists. Confirm that the domain is not in use for services external to Cloudron'; + if (result.error) { + if (result.error.reason === ERROR.ACCESS_DENIED) { + $scope.appInstall.error.location = 'DNS credentials for ' + data.domain + ' are invalid. Update it in Domains & Certs view'; + } else { + $scope.appInstall.error.location = result.error.message; + } + } else { + $scope.appInstall.error.location = 'DNS Record already exists. Confirm that the domain is not in use for services external to Cloudron'; + $scope.appInstall.needsOverwrite = true; + } $scope.appInstall.busy = false; $scope.appInstallForm.location.$setPristine(); $('#appInstallLocationInput').focus();