DeloitteOptimalReality/LightOSM.jl

Inconsistent Error type thrown for shortest_path

hs-ye opened this issue · 2 comments

hs-ye commented

To investigate: When using shortest_path, it seems that if a path is not found it throws a LoadError

g = graph_from_download(:point, point=GeoLocation([-37.6965,145.0937]), radius=5, metadata=true)
path = LightOSM.shortest_path(g, 27162110, 679051448, algorithm=:astar)  # this is a LoadError

However, when this is wrapped in a try-catch, the type of the error gets changed to a generic exception error?

try
    path = LightOSM.shortest_path(g, 27162110, 679051448, algorithm=:astar)
catch err
    if isa(err, LoadError)
        println(err)
    else
        println("Not a Load err", err)  # ExceptionError
    end
end
hs-ye commented

Upon further testing - it seems the issue is with the error message itself - the actual error is the key error (the part in red) rather than the LoadError. Catching this exception is working on my windows machine, will double check on my mac then we can close this.
image

hs-ye commented

Confirm same on Mac as well - just the error message is confusing!