From 6562e1511c548e129bf1fae3871650362c7f92f3 Mon Sep 17 00:00:00 2001 From: Vishal <64505169+vishalxl@users.noreply.github.com> Date: Sun, 25 Dec 2022 01:24:17 +0530 Subject: [PATCH] caught uri error in getchNIP05Info verification method --- lib/event_ds.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/event_ds.dart b/lib/event_ds.dart index f0a32ba..b0f1657 100644 --- a/lib/event_ds.dart +++ b/lib/event_ds.dart @@ -1024,11 +1024,20 @@ String getRelayOfUser(String userPubkey, String contactPubkey) { return relay; } +// https://codewithandrea.com/articles/flutter-exception-handling-try-catch-result-type/ + Future fetchNip05Info(String nip05Url) { //print("in fetch nip: url = $nip05Url"); - var retval = http.get(Uri.parse(nip05Url)); - - return retval; + http.Response resp = http.Response.bytes([], 404); + //if( nip05Url == "http://nostrplebs.com:12a6ae3eaeb02663/.well-known/nostr.json?name=yashraj") print('got yashraj'); + + try { + return http.get(Uri.parse(nip05Url)); + + } catch(ex) { + //print("returning default value from fetchNIP05Info"); + return Future.value(resp); + } } // If given event is kind 0 event, then populates gKindONames with that info