Catching (HTTP) Exception and throw again in R -


i trying catch , again throw exception in r. client can read exception , handle it.

i have tried these links, none of them works

equivalent of "throw" in r

how return error message in r?

to exact need rewrite program in r.

import java.io.ioexception; import java.io.inputstream; import java.net.malformedurlexception; import java.net.url;  public class test {     public static void main(string s[]) throws ioexception  {         url url;         try {             url = new url("https://google.com");             inputstream = url.openconnection().getinputstream();             system.out.println(is);         } catch (malformedurlexception e) {             e.printstacktrace();             throw e;         } catch (ioexception e) {             e.printstacktrace();             throw e;         }     } } 

here have tried

library(bitops) library(rcurl) library(stringr) library(stringi) library(xml) library(httr) library(methods) library(getpass) library(odata) library(xml2) library(curl) status <- function() {   data = trycatch({     url = "http://services.odata.org/v4/(s(cscsmmmc110sj01dvwgyolkm))/trippinservicerw/people('rufssellwhyte')/microsoft.odata.sampleservice.models.trippin.getfavoriteairline"     print(retrievedata(url))   }, error = function(error_message) {     print("hi")     print(error_message)     return (na)   }, = {    }) } 

and correct url

"http://services.odata.org/v4/(s(cscsmmmc110sj01dvwgyolkm))/trippinservicerw/people('russellwhyte')/microsoft.odata.sampleservice.models.trippin.getfavoriteairline"

i need print hi , error msg if there error , throw error.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -