Try Catch not catching ": unknown I / O error" - I / O warning: Failed to load external object

The code below it is part of the function. The getLatestFileName function gets the correct filename (stored locally).

The error was caused by tryCatch: result <- try (xbrlDoAll ...) Although I tried to catch it with try and try catch function, I even changed the parameters show.error.messages = FALSE. I keep getting the following output which causes R to crash:

[1] "FINAL STEP"

[1] "STEP 1"

Error: Unknown I / O error

I / O warning: Failed to load external object http://xbrl.us/us-gaap/1.0/elts/us-gaap-all-2008-03-31.xsd "

Based on what I typed, I believe the error is caused by the XBRL package when it tries to get information from the above URL.

Can anyone help me?

  instance <- getLatestFileName(ticker, date, type)
  options(stringsAsFactors = FALSE)
  result <- NA
  #result <- try(xbrlDoAll(instance, cache.dir = "XBRLcache", prefix.out = NULL), silent = TRUE)

  tryCatch({
      print("STEP 1")
      options(show.error.messages = FALSE)
      result <- try(xbrlDoAll(instance, cache.dir = NULL, prefix.out =  NULL), silent = TRUE)
      print("STEP2")
    }, warning <- function(w) {
      result <- NA
      print("WARNING")
    }, error = function(e) {
      result <- NA
      print(result)
      print("Test")
    }, finally <- {
      print("FINAL STEP")
    })

  try(is.na(result))
  print("we did get here")

      

+3


source to share


1 answer


I solved this particular problem by placing all taxonomy files from 2008 in my XBRLCache folder.

I have downloaded the correct files (not empty as was the error) from this link:

http://xbrl.us/documents/XBRLUSGAAPTaxonomies-2008-03-31.zip



There might be a problem loading the page as I've seen it doesn't always work. These servers are probably too busy.

I hope this works for other people too!

Too bad I didn't solve the awkward problem.

0


source







All Articles