add account merge error

This commit is contained in:
Ersun Warncke 2018-10-09 06:55:14 -04:00
parent 914546d7d6
commit 7652e80800
3 changed files with 27 additions and 0 deletions

View file

@ -13,6 +13,11 @@ module.exports = ErrorController =
res.render 'general/500', res.render 'general/500',
title: "Server Error" title: "Server Error"
accountMergeError: (req, res)->
res.status(500)
res.render 'general/account-merge-error',
title: "Account Access Error"
handleError: (error, req, res, next) -> handleError: (error, req, res, next) ->
user = AuthenticationController.getSessionUser(req) user = AuthenticationController.getSessionUser(req)
if error?.code is 'EBADCSRFTOKEN' if error?.code is 'EBADCSRFTOKEN'
@ -33,6 +38,9 @@ module.exports = ErrorController =
logger.warn {err: error, url: req.url}, "invalid name error" logger.warn {err: error, url: req.url}, "invalid name error"
res.status(400) res.status(400)
res.send(error.message) res.send(error.message)
else if error instanceof Errors.AccountMergeError
logger.error err: error, "account merge error"
ErrorController.accountMergeError req, res
else else
logger.error err: error, url:req.url, method:req.method, user:user, "error passed to top level next middlewear" logger.error err: error, url:req.url, method:req.method, user:user, "error passed to top level next middlewear"
ErrorController.serverError req, res ErrorController.serverError req, res

View file

@ -89,6 +89,13 @@ InvalidError = (message) ->
return error return error
InvalidError.prototype.__proto__ = Error.prototype 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 = module.exports = Errors =
NotFoundError: NotFoundError NotFoundError: NotFoundError
ServiceNotConfiguredError: ServiceNotConfiguredError ServiceNotConfiguredError: ServiceNotConfiguredError
@ -103,3 +110,4 @@ module.exports = Errors =
UnconfirmedEmailError: UnconfirmedEmailError UnconfirmedEmailError: UnconfirmedEmailError
EmailExistsError: EmailExistsError EmailExistsError: EmailExistsError
InvalidError: InvalidError InvalidError: InvalidError
AccountMergeError: AccountMergeError

View file

@ -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] for assistance.