Skip to content

Commit 8d60a81

Browse files
committed
Removed strange toForbiddenException
1 parent 2f5d1e8 commit 8d60a81

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

services-api/src/main/java/io/scalecube/services/methods/ServiceMethodInvoker.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import io.scalecube.services.auth.Principal;
77
import io.scalecube.services.auth.PrincipalMapper;
88
import io.scalecube.services.exceptions.ForbiddenException;
9-
import io.scalecube.services.exceptions.ServiceException;
109
import io.scalecube.services.exceptions.ServiceProviderErrorMapper;
1110
import io.scalecube.services.transport.api.ServiceMessageDataDecoder;
1211
import java.lang.reflect.InvocationTargetException;
@@ -264,15 +263,6 @@ private Mono<Principal> mapPrincipal(RequestContext context) {
264263
}
265264

266265
return Mono.defer(() -> principalMapper.map(context))
267-
.switchIfEmpty(Mono.just(context.principal()))
268-
.onErrorMap(ServiceMethodInvoker::toForbiddenException);
269-
}
270-
271-
private static ForbiddenException toForbiddenException(Throwable ex) {
272-
if (ex instanceof ServiceException e) {
273-
return new ForbiddenException(e.errorCode(), e.getMessage());
274-
} else {
275-
return new ForbiddenException(ex);
276-
}
266+
.switchIfEmpty(Mono.just(context.principal()));
277267
}
278268
}

0 commit comments

Comments
 (0)