Skip to content

Commit 75aaaa6

Browse files
committed
fix: improper 500 in wisp token verify
1 parent 7aa886d commit 75aaaa6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/backend/src/services/WispService.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,17 @@ class WispService extends BaseService {
5757
const svc_apiError = this.services.get('api-error');
5858
const svc_event = this.services.get('event');
5959

60-
const decoded = svc_token.verify('wisp', req.body.token);
61-
if ( decoded.$ !== 'token:wisp' ) {
62-
throw svc_apiError.create('invalid_token');
63-
}
60+
const decoded = (() => {
61+
try {
62+
const decoded = svc_token.verify('wisp', req.body.token);
63+
if ( decoded.$ !== 'token:wisp' ) {
64+
throw svc_apiError.create('invalid_token');
65+
}
66+
return decoded;
67+
} catch (e) {
68+
throw svc_apiError.create('forbidden');
69+
}
70+
})();
6471

6572
const svc_getUser = this.services.get('get-user');
6673

0 commit comments

Comments
 (0)