paleolimbot commented on code in PR #12323:
URL: https://github.com/apache/arrow/pull/12323#discussion_r848300434


##########
r/R/io.R:
##########
@@ -244,32 +245,59 @@ make_readable_file <- function(file, mmap = TRUE, 
compression = NULL, filesystem
   }
   if (is.string(file)) {
     if (is_url(file)) {
-      fs_and_path <- FileSystem$from_uri(file)
-      filesystem <- fs_and_path$fs
-      file <- fs_and_path$path
+      file <- tryCatch({
+        fs_and_path <- FileSystem$from_uri(file)
+        filesystem <- fs_and_path$fs
+        fs_and_path$path
+      }, error = function(e) {
+        MakeRConnectionInputStream(url(file, open = "rb"))

Review Comment:
   It's not winning any awards, but it's not bad!
   
   ``` r
   arrow::read_ipc_stream("https://httpbin.org/status/404";)
   #> Warning in url(file, open = "rb"): cannot open URL 
'https://httpbin.org/status/
   #> 404': HTTP status was '404 Not Found'
   #> Error in url(file, open = "rb"): cannot open the connection to 
'https://httpbin.org/status/404'
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to