diff --git a/services/web/app/coffee/Features/Errors/ErrorController.coffee b/services/web/app/coffee/Features/Errors/ErrorController.coffee index 50f0ba3c06..25760bb1c3 100644 --- a/services/web/app/coffee/Features/Errors/ErrorController.coffee +++ b/services/web/app/coffee/Features/Errors/ErrorController.coffee @@ -13,6 +13,11 @@ module.exports = ErrorController = res.render 'general/500', title: "Server Error" + accountMergeError: (req, res)-> + res.status(500) + res.render 'general/account-merge-error', + title: "Account Access Error" + handleError: (error, req, res, next) -> user = AuthenticationController.getSessionUser(req) if error?.code is 'EBADCSRFTOKEN' @@ -33,6 +38,9 @@ module.exports = ErrorController = logger.warn {err: error, url: req.url}, "invalid name error" res.status(400) res.send(error.message) + else if error instanceof Errors.AccountMergeError + logger.error err: error, "account merge error" + ErrorController.accountMergeError req, res else logger.error err: error, url:req.url, method:req.method, user:user, "error passed to top level next middlewear" ErrorController.serverError req, res diff --git a/services/web/app/coffee/Features/Errors/Errors.coffee b/services/web/app/coffee/Features/Errors/Errors.coffee index 3239bbbb58..0b20992faa 100644 --- a/services/web/app/coffee/Features/Errors/Errors.coffee +++ b/services/web/app/coffee/Features/Errors/Errors.coffee @@ -89,6 +89,13 @@ InvalidError = (message) -> return error InvalidError.prototype.__proto__ = Error.prototype +AccountMergeError = (message) -> + error = new Error(message) + error.name = "AccountMergeError" + error.__proto__ = AccountMergeError.prototype + return error +AccountMergeError.prototype.__proto__ = Error.prototype + module.exports = Errors = NotFoundError: NotFoundError ServiceNotConfiguredError: ServiceNotConfiguredError @@ -103,3 +110,4 @@ module.exports = Errors = UnconfirmedEmailError: UnconfirmedEmailError EmailExistsError: EmailExistsError InvalidError: InvalidError + AccountMergeError: AccountMergeError diff --git a/services/web/app/views/general/account-merge-error.pug b/services/web/app/views/general/account-merge-error.pug new file mode 100644 index 0000000000..68af40a267 --- /dev/null +++ b/services/web/app/views/general/account-merge-error.pug @@ -0,0 +1,11 @@ +extends ../layout + +block content + .content.content-alt + .container + .row + .col-md-6.col-md-offset-3 + .card + .page-header + h1 Account Access Error + p.text-danger Sorry, an error occurred accessing your account. Please #[a(href="" ng-controller="ContactModal" ng-click="contactUsModal()") contact support] and provide any email addresses that you have used to sign in to Overleaf and/or ShareLaTeX for assistance.