Skip to content

Commit

Permalink
revert error-handler logic to before to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo committed Nov 11, 2023
1 parent f37eca3 commit 4ea171d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/api/scripts/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ prog
outfile: path.join(__dirname, '..', 'dist', 'worker.js'),
legalComments: 'external',
inject: [path.join(__dirname, 'node-globals.js')],
loader: { '.js': 'jsx' },
plugins: [
{
name: 'alias',
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export function errorHandler (err, { log }, request) {
return new JSONResponse(error, { status })
}

if (err instanceof HTTPError) {
return new JSONResponse(err, { status })
}

let error = {
code: err.code,
message: err.message
}

if (err instanceof HTTPError) {
return new JSONResponse(error, { status })
}

switch (err.code) {
// Magic SDK errors
case MagicErrors.TokenExpired:
Expand Down
1 change: 0 additions & 1 deletion packages/api/test/user.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ describe('userLoginPost', function () {
assert.equal(typeof responseJson, 'object', 'response can be parsed as json')
assert.ok(responseJson.message.includes('new user registration is closed'), 'response object message indicates new user registration is closed')
assert.equal(responseJson.code, 'NEW_USER_DENIED_TRY_OTHER_PRODUCT')
assert.equal(responseJson.otherProduct, 'https://console.web3.storage/')
})
})
})

0 comments on commit 4ea171d

Please sign in to comment.