From 047511dee02e2f6896f9c8209c7096fc8671e748 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Fri, 27 Oct 2017 13:01:18 +0200 Subject: [PATCH] simplified resume errors - result.login & consent won't be used anyway - createError not needed when ctx is involved --- lib/shared/resume.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/shared/resume.js b/lib/shared/resume.js index 1ba790c68..4ae27f6d0 100644 --- a/lib/shared/resume.js +++ b/lib/shared/resume.js @@ -1,5 +1,3 @@ -const assert = require('assert'); -const createError = require('http-errors'); const uuid = require('uuid/v4'); const url = require('url'); const _ = require('lodash'); @@ -32,16 +30,9 @@ module.exports = function getResumeAction(provider) { ctx.cookies.set(provider.cookieName('resume'), null, clearOpts); if (result.error) { - assert(!result.login, 'login shouldn\'t be provided with an error result'); - assert(!result.consent, 'consent shouldn\'t be provided with an error result'); - assert(typeof result.error === 'string', 'error should be a string'); - - const description = result.error_description - ? { error_description: result.error_description } - : undefined; - const err = createError(400, result.error, description); - - ctx.throw(err); + ctx.throw(400, result.error, { + error_description: result.error_description, + }); } if (result.login) {