Replies: 11 comments 13 replies
-
Since This approach is described in the rlang documentation as well as this recent blog post by Nick Tierney: https://www.njtierney.com/post/2023/12/06/long-errors-smell/ I think there are a few different opportunities to enhance the input checks, error messages, and error handling in the package, TBH. Happy to work on this in combination with this issue or submit a separate issue with an outline of potential changes (I'm partial to the tidyverse style guide on error messages) before spending time on a PR. |
Beta Was this translation helpful? Give feedback.
-
Thanks, Eli! I was thinking more about users, not package developers, but the latter seems like something worth considering. Is your suggestion that top level functions like |
Beta Was this translation helpful? Give feedback.
-
I'd love to see the former so I can wrap Apologies if I'm accidentally hijacking your original issue! I'd assume that |
Beta Was this translation helpful? Give feedback.
-
Exactly what I was thinking! No worries about hijacking. They seem sufficiently related to me to warrant discussion in the same place. And, actually, the docs for
If that's feasible, maybe we could just add a tutorial for package devs to the docs? |
Beta Was this translation helpful? Give feedback.
-
Man, this took forever to track down! For posterity: #62 (comment) |
Beta Was this translation helpful? Give feedback.
-
I'm still a bit unclear what the scope of this issue is. Do you think we can narrow it down? @kbvernon in the case of handling errors directly from a feature service, its unfortunately bit dirtier than I'd like. See Regarding
|
Beta Was this translation helpful? Give feedback.
-
I think my original thought here (keep in mind it was a Friday afternoon...) was that Just to add to this, one of the things that came out of our Discord discussion the other day was that ESRI doesn't necessarily do the "sanitizing" (is that the right word?) the same way as |
Beta Was this translation helpful? Give feedback.
-
re "sanitizing", on the whole, not really for feature services. I'm sure there's some legacy reason for it and the Esri equivalent of "for compatibility with S." Other newer services (e.g. knowledge graph) probably don't have the same issues. Here's an example using httr2 directly. This is a very handy dandy tool! # FeatureServer
furl <- paste0(
"https://services3.arcgis.com/ZvidGQkLaDJxRSJ2/arcgis/rest/services/",
"PLACES_LocalData_for_BetterHealth/FeatureServer"
)
arcgislayers::arc_open(furl)
#> <FeatureServer <5 layers, 0 tables>>
#> CRS: 3785
#> Capabilities: Query,Extract
#> 0: PlacePoints (esriGeometryPoint)
#> 1: PlaceBoundaries (esriGeometryPolygon)
#> 2: Counties (esriGeometryPolygon)
#> 3: Tracts (esriGeometryPolygon)
#> 4: ZCTAs (esriGeometryPolygon)
httr2::last_request()
#> <httr2_request>
#> GET
#> https://services3.arcgis.com/ZvidGQkLaDJxRSJ2/arcgis/rest/services/PLACES_LocalData_for_BetterHealth/FeatureServer?f=json
#> Body: empty
httr2::last_response()
#> <httr2_response>
#> GET
#> https://services3.arcgis.com/ZvidGQkLaDJxRSJ2/arcgis/rest/services/PLACES_LocalData_for_BetterHealth/FeatureServer?f=json
#> Status: 200 OK
#> Content-Type: application/json
#> Body: In memory (9309 bytes) Created on 2024-01-23 with reprex v2.0.2 |
Beta Was this translation helpful? Give feedback.
-
Maybe? That was one of the questions I posed to you initially. Personally, the |
Beta Was this translation helpful? Give feedback.
-
This function looks super messy but here is one possible approach to catching errors:
I'm not sure if or how to integrate |
Beta Was this translation helpful? Give feedback.
-
I've converted this to a discussion because I don't think there's a clear issue that we're trying to solve with it quite yet. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
No specific problem, just thinking about how to help users with future debugging.
Describe the solution you'd like
I'm sure you knew this, but
{httr2}
has some tools likelast_request()
andlast_response()
that may be useful since they can help to inspect the request/response for clues. In fact, because you are already building on{httr2}
, these can be used on{arcgislayers}
request/responses directly.Describe alternatives you've considered
You could wrap these if you want to avoid the API weirdness for the user of calling on other packages to inspect this one's classes, but maybe that's not a big issue? Or not an issue at all? Could just add something to the docs with some examples of using the
{httr2}
functions, assuming you think that would be worthwhile.Additional context
Friday afternoon...
Beta Was this translation helpful? Give feedback.
All reactions