mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 22:46:22 +02:00
Reduces errors when trying to parse unparseable NIP-11s
This commit is contained in:
@@ -175,7 +175,11 @@ class Nip11Retriever {
|
|||||||
val body = response.body.string()
|
val body = response.body.string()
|
||||||
try {
|
try {
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
onInfo(Nip11RelayInformation.fromJson(body))
|
if (body.startsWith("{")) {
|
||||||
|
onInfo(Nip11RelayInformation.fromJson(body))
|
||||||
|
} else {
|
||||||
|
onError(relay, ErrorCode.FAIL_TO_PARSE_RESULT, body)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
onError(relay, ErrorCode.FAIL_WITH_HTTP_STATUS, response.code.toString())
|
onError(relay, ErrorCode.FAIL_WITH_HTTP_STATUS, response.code.toString())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user