Hello,
try
response = HTTP.request(
"GET",
"https://invalid-url.com.au",
["Content-Type" => "application/json"];
require_ssl_verification=false,
)
println(string("dummy_method() response ", response.status))
return JSON3.read(response.body)
catch e
println("Error occurred: $e")
if e isa(DNSError)
println("Encountered a DNSError in Julia. Check your internet connection " *
" and/or make sure you have a valid url")
end
end
I’m trying to make a GET request to an intentionally invalid API URL address and I’m receiving some error output that looks like so:
Error occurred: DNSError: invalid-url.com.au, unknown node or service (EAI_NONAME)
ERROR: UndefVarError: DNSError not defined
I’m wondering why DNSError is not defined when I try to catch it, especially given that when I print the error message it says DNSError so I haven’t pulled the name out of nowhere when I try to catch it. For clarification, when I pass a valid URL for the HTTP.request() call, my program works just fine.
Is DNSError a part of the HTTP package? If so, why does it say that DNSError is not recognized when I have the HTTP package installed and am able to run it fine with valid URL’s?
Any help would be appreciated. Hopefully I’m not missing something glaringly obvious. Cheers