Skip to content

Commit 46eaa1c

Browse files
committed
test
1 parent 5552ae0 commit 46eaa1c

File tree

3 files changed

+2
-128
lines changed

3 files changed

+2
-128
lines changed

src/commonMain/kotlin/spp.protocol/platform/error/JWTVerificationException.kt

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/commonMain/kotlin/spp.protocol/platform/error/MissingRemoteException.kt

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/jvmMain/kotlin/spp/protocol/extend/TCPServiceFrameParser.kt

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import io.vertx.ext.bridge.BridgeEventType
2929
import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper
3030
import org.slf4j.LoggerFactory
3131
import spp.protocol.platform.auth.RolePermission
32-
import spp.protocol.platform.error.JWTVerificationException
33-
import spp.protocol.platform.error.MissingRemoteException
3432
import spp.protocol.service.error.InstrumentAccessDenied
3533
import spp.protocol.service.error.LiveInstrumentException
3634
import spp.protocol.service.error.LiveInstrumentException.ErrorType
@@ -94,7 +92,7 @@ class TCPServiceFrameParser(val vertx: Vertx, val socket: NetSocket) : Handler<A
9492
}
9593
} else if ("err" == frame.getString("type")) {
9694
//directly thrown event bus exceptions
97-
handleErrorFrame(frame)
95+
throw ReplyException(ReplyFailure.ERROR, frame.getString("message"))
9896
} else {
9997
throw UnsupportedOperationException(frame.toString())
10098
}
@@ -127,49 +125,7 @@ class TCPServiceFrameParser(val vertx: Vertx, val socket: NetSocket) : Handler<A
127125
}
128126
vertx.eventBus().send(frame.getString("address"), error)
129127
} else {
130-
//i think these are service exceptions
131-
val error = ReplyException(
132-
ReplyFailure.RECIPIENT_FAILURE,
133-
frame.getInteger("failureCode"),
134-
frame.getString("rawFailure")
135-
)
136-
var debugInfo = JsonObject(frame.getString("rawFailure")).getJsonObject("debugInfo")
137-
if (frame.getString("message").contains("JWT")) {
138-
error.initCause(JWTVerificationException(frame.getString("message")))
139-
} else if (debugInfo == null) {
140-
debugInfo = JsonObject().put(
141-
"causeMessage", JsonObject(frame.getString("message")).getString("message")
142-
)
143-
}
144-
145-
if (debugInfo.getString("causeName") == MissingRemoteException::class.java.name) {
146-
error.initCause(MissingRemoteException(debugInfo.getString("causeMessage")))
147-
} else {
148-
val causeMessage = debugInfo.getString("causeMessage")
149-
if (causeMessage?.startsWith("EventBusException:") == true) {
150-
val exceptionType = causeMessage.substringAfter("EventBusException:")
151-
.substringBefore("[")
152-
val exceptionParams = causeMessage.substringAfter("[").substringBefore("]")
153-
val exceptionMessage = causeMessage.substringAfter("]: ").trimEnd()
154-
when (exceptionType) {
155-
LiveInstrumentException::class.simpleName -> {
156-
error.initCause(
157-
LiveInstrumentException(
158-
ErrorType.valueOf(exceptionParams),
159-
exceptionMessage
160-
)
161-
)
162-
}
163-
InstrumentAccessDenied::class.simpleName -> {
164-
error.initCause(InstrumentAccessDenied(exceptionParams))
165-
}
166-
else -> TODO()
167-
}
168-
} else {
169-
TODO()
170-
}
171-
}
172-
vertx.eventBus().send(frame.getString("address"), error)
128+
throw UnsupportedOperationException(frame.toString())
173129
}
174130
}
175131
}

0 commit comments

Comments
 (0)