Skip to content

Commit

Permalink
return error message from azure maps get geocoding api
Browse files Browse the repository at this point in the history
  • Loading branch information
tedpearson committed Jun 22, 2024
1 parent af0805a commit 0a0e19d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions location.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ func (l LocationService) lookup(s string, location *Location) error {
fmt.Printf("Failed to parse json %s\n", buf.String())
return err
}
errorCode := val.GetStringBytes("error", "code")
errorMsg := val.GetStringBytes("error", "message")
if errorMsg != nil {
return fmt.Errorf("failed to look up location '%s', error: %s, %s", s, string(errorCode), string(errorMsg))
}
record := val.Get("features", "0")
coords := record.GetArray("geometry", "coordinates")
if record == nil || coords == nil {
Expand Down

0 comments on commit 0a0e19d

Please sign in to comment.