Reduces errors when trying to parse unparseable NIP-11s

This commit is contained in:
Vitor Pamplona
2025-09-02 17:34:15 -04:00
parent f6d283dafb
commit 0bc0f503be

View File

@@ -175,7 +175,11 @@ class Nip11Retriever {
val body = response.body.string()
try {
if (response.isSuccessful) {
onInfo(Nip11RelayInformation.fromJson(body))
if (body.startsWith("{")) {
onInfo(Nip11RelayInformation.fromJson(body))
} else {
onError(relay, ErrorCode.FAIL_TO_PARSE_RESULT, body)
}
} else {
onError(relay, ErrorCode.FAIL_WITH_HTTP_STATUS, response.code.toString())
}