File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/jvmMain/kotlin/spp/protocol/marshall Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1818package spp.protocol.marshall
1919
2020import io.vertx.serviceproxy.ServiceException
21+ import spp.protocol.platform.auth.RolePermission
22+ import spp.protocol.service.error.InstrumentAccessDenied
2123import spp.protocol.service.error.LiveInstrumentException
24+ import spp.protocol.service.error.PermissionAccessDenied
2225
2326object ServiceExceptionConverter {
2427
25- fun fromEventBusException (exception : String ): ServiceException {
28+ fun fromEventBusException (exception : String , toEventBusException : Boolean = false ): ServiceException {
2629 return if (exception.startsWith(" EventBusException" )) {
2730 var exceptionType = exception.substringAfter(" EventBusException:" )
2831 exceptionType = exceptionType.substringBefore(" [" )
@@ -33,6 +36,16 @@ object ServiceExceptionConverter {
3336 LiveInstrumentException (
3437 LiveInstrumentException .ErrorType .valueOf(exceptionParams),
3538 exceptionMessage
39+ ).let { if (toEventBusException) it.toEventBusException() else it }
40+ } else if (InstrumentAccessDenied ::class .java.simpleName == exceptionType) {
41+ InstrumentAccessDenied (
42+ exceptionParams,
43+ exceptionMessage
44+ ).let { if (toEventBusException) it.toEventBusException() else it }
45+ } else if (PermissionAccessDenied ::class .java.simpleName == exceptionType) {
46+ PermissionAccessDenied (
47+ RolePermission .valueOf(exceptionParams),
48+ exceptionMessage
3649 ).toEventBusException()
3750 } else {
3851 throw UnsupportedOperationException (exceptionType)
You can’t perform that action at this time.
0 commit comments