romainfrancois commented on a change in pull request #11751:
URL: https://github.com/apache/arrow/pull/11751#discussion_r761968958



##########
File path: r/R/type.R
##########
@@ -55,6 +59,12 @@ DataType$import_from_c <- ImportType
 INTEGER_TYPES <- as.character(outer(c("uint", "int"), c(8, 16, 32, 64), 
paste0))
 FLOAT_TYPES <- c("float16", "float32", "float64", "halffloat", "float", 
"double")
 
+code_carefully <- function(type, msg) {

Review comment:
       The idea is to support things like this: 
   
   
   ``` r
   library(arrow, warn.conflicts = FALSE)
   #> See arrow_info() for available features
   
   tryCatch(
     error=print, 
     struct(a = arrow:::DayTimeInterval__initialize())$code()
   )
   #> <error/rlang_error>
   #> Error in `code()`:
   #>   Problem getting code for field "a".
   #> Caused by error in `code()`:
   #>   Unsupported type: <day_time_interval>.
   #>   ℹ The arrow package currently has no function to make these.
   ```
   
   <sup>Created on 2021-12-03 by the [reprex 
package](https://reprex.tidyverse.org) (v2.0.1.9000)</sup>
   
   instead of: 
   
   ``` r
   library(arrow, warn.conflicts = FALSE)
   #> See arrow_info() for available features
   
   tryCatch(
     error=print, 
     struct(a = arrow:::DayTimeInterval__initialize())$code()
   )
   #> <error/rlang_error>
   #> Error in `code()`: Unsupported type: <day_time_interval>.
   #> ℹ The arrow package currently has no function to make these.
   ```
   
   <sup>Created on 2021-12-03 by the [reprex 
package](https://reprex.tidyverse.org) (v2.0.1.9000)</sup>
   
   but maybe that's overkill. 
   




-- 
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