mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 08:47:33 +00:00
fix: log unparseable relay frames at WARN, not ERROR
A frame the client can't decode (non-standard framing, unknown command,
malformed JSON) is a relay-side quirk, not an Amethyst error. For example,
multiplextr.coracle.social replies to a plain REQ with its own multiplexer
envelope `[{"relays":[]},["NOTICE","","Unable to handle message"]]`, whose
first element is an object rather than a command label, so the decoder
throws `Message null is not supported`.
BasicRelayClient already drops such frames and its comment states it
"doesn't expose parsing errors to lib users as errors", yet it logged at
ERROR. Downgrade to WARN so these relay-side quirks stop surfacing as app
errors.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01THVD3sY6xrxGzBHhUnhJAY
This commit is contained in:
+4
-2
@@ -160,8 +160,10 @@ open class BasicRelayClient(
|
||||
listener.onIncomingMessage(this@BasicRelayClient, text, msg)
|
||||
} catch (e: Throwable) {
|
||||
if (e is CancellationException) throw e
|
||||
// doesn't expose parsing errors to lib users as errors
|
||||
Log.e("BasicRelayClient", "Failure to parse message from ${url.url}: $text", e)
|
||||
// A frame we can't parse is a relay-side quirk (non-standard framing, an
|
||||
// unknown command, malformed JSON), not an Amethyst error. Drop it and log
|
||||
// at WARN so it doesn't surface as an app error to lib users.
|
||||
Log.w("BasicRelayClient", "Failure to parse message from ${url.url}: $text", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user