AtlasOfLivingAustralia / galah-R

Query living atlases from R
https://galah.ala.org.au
38 stars 3 forks source link

Unhelpful error when email is incorrect in `galah_config()` #179

Closed daxkellie closed 1 year ago

daxkellie commented 1 year ago

When an email is misspelled in galah_config(), the error message is very unhelpful

library(galah)
galah_config(email = "email-is-wrong@email.com",
             verbose = FALSE)
galah_call() |> 
    galah_identify("Anas superciliosa")|>              
    atlas_occurrences()
#> Status code 500 returned for url https://biocache-ws.ala.org.au/ws/occurrences/offline/download?fq=%28lsid%3Ahttps%3A%2F%2Fbiodiversity.org.au%2Fafd%2Ftaxa%2Ff194ab1a-ae82-4ad6-bc42-55b47f55d125%29&disableAllQualityFilters=true&fields=decimalLatitude%2CdecimalLongitude%2CeventDate%2CscientificName%2CtaxonConceptID%2CrecordID%2CdataResourceName%2CoccurrenceStatus&qa=none&emailNotify=false&sourceTypeId=2004&reasonTypeId=4&email=olivia.torresan%40hotmail.com&dwcHeaders=true.
#> • Status code 500 returned for url <pointer: 0x1417b61c0>.
#> # A tibble: 0 × 0

It would be nice to suggest to check whether the user's email is entered correctly when a code 500 error is returned

daxkellie commented 1 year ago

Just wanted to note that a Status code 500 error is generated when an email address is incorrectly entered with an @ symbol, but a Status code 400 error is triggered when an email address is entered incorrectly without an @ symbol.

Status code 400 is usually a more "catch-all" error, so for now I have only implemented a specific error message for a Status code 500 error. More investigating needs to be done whether the same solution could work for a 400 error.

daxkellie commented 1 year ago

This also explicitly solves issue #173

mjwestgate commented 1 year ago

Close as complete