File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,16 @@ module.exports = (app) => {
50
50
if ( req . authUser . isMachine ) {
51
51
next ( )
52
52
} else {
53
- req . authUser . userId = String ( req . authUser . userId )
54
- const user = await helper . getMemberById ( req . authUser . userId )
55
- if ( ! user || _ . intersection ( [ user . homeCountryCode , user . competitionCountryCode ] , def . forbiddenCountries ) . length > 0 ) {
53
+ try {
54
+ req . authUser . userId = String ( req . authUser . userId )
55
+ const user = await helper . getMemberById ( req . authUser . userId )
56
+ if ( ! user || _ . intersection ( [ user . homeCountryCode , user . competitionCountryCode ] , def . forbiddenCountries ) . length > 0 ) {
57
+ throw new errors . ForbiddenError ( 'Access denied' )
58
+ }
59
+ next ( )
60
+ } catch ( e ) {
56
61
throw new errors . ForbiddenError ( 'Access denied' )
57
62
}
58
- next ( )
59
63
}
60
64
} )
61
65
}
You can’t perform that action at this time.
0 commit comments