Closed sanmiawi closed 3 years ago
Hey unfortunately it's not possible to catch these as Chrome and other browsers always will log whenever 404s happen, regardless of if you catch the error or not :/
Hi, I do not mind that the error is logged in console. I would like to know that it occurred and make a different decision based on the occurrence of an error. If there is no thrown error, do you think its possible to parse the response from connect.3box.io
?
Hi, its ok. I think I will just use axios
get request https://ipfs.3box.io/profile?address=
and parse the result from that before using the getProfile function. Thanks
When I try to use the getProfile method it works with a valid address but I would like to read the error returned if an invalid address is entered example
await threeBox.getProfile('abcdefghijklmnopqrstuvwxyz')
returns the following error in developer tools
{"status":"error","message":"Address link not found, address does not have a 3Box or is malformed"}
but I cannot read this error using
try/catch
orthreeBox.getProfile('abcdefghijklmnopqrstuvwxyz').catch(err => {console.error(err)});
sequencehow can I read the error in my code?