gsimchoni / ebayr

R wrapper to the ebay Finding API
2 stars 0 forks source link

Feature request: Add API message when error #3

Closed dcaud closed 5 years ago

dcaud commented 5 years ago

It would be nice to have a more informative error message in the search_ebay function.

This already gives a generic error:

    if (httr::http_error(resp)) {
      stop(sprintf("ebay API request failed [%s]", httr::status_code(resp)), 
           call. = FALSE)
    }

Adding something like the below around line 345 might might be helpful to parse the error message:

    if (httr::http_error(resp)) {
      parsed.error <- jsonlite::fromJSON(httr::content(resp, "text"), 
                                   simplifyVector = FALSE)
      parsed.error[["errorMessage"]][[1]][["error"]][[1]][["message"]][[1]]
      stop(sprintf("ebay API request failed [%s]", httr::status_code(resp)), 
           call. = FALSE)
    }
gsimchoni commented 5 years ago

Closing as it seems ebay is shutting down its open API: https://ebaydts.com/eBayKBDetails?KBid=5102