Skip to main content

Hi,

I have one script in R running in RCaller, but the RCaller show some messages like erros but no erros, my script run properly.

 

I would like to ignore these messages and generate one feature for the next transformer. How can I do this?

 

 

Thank´s

Depending on how the RCaller is ‘failing’ I can think of two approaches (FYI i’ve never used R).

  1. If the RCaller is not outputing a feature because it doesn’t return a feature to trigger the rest of the workspace, you could put a NoFeatureTester after it and this will create a feature if none are recieved.
  2. If the RCaller is failing and is therefore causing the workspace to fail, you could look to use the tryCatch() function - https://stackoverflow.com/questions/12193779/how-to-use-the-trycatch-function

Hi @hkingsbury 

 

I tried your options, but unsuccess.

 

No FeatureTester no show features after erro in RCaller.

Try Catch too...no work properly. Shows errors in RCaller.

 

Thank you

 

 


Can you share how you’ve implemented the tryCatch() in you code?

The purpose of try-catch functions are to gracefully catch errors allowing processes to properly manage them with out failing


@hkingsbury,

 

Unfortunately I can´t send the code, but my implemantation is like below:

 

 tryCatch(
{
# Just to highlight: if you want to use more than one
# R expression in the "try" part then you'll have to
# use curly brackets.
# 'tryCatch()' will return the last evaluated expression
# in case the "try" part was completed successfully

message("This is the 'try' part")

suppressWarnings(readLines(url))
# The return value of `readLines()` is the actual value
# that will be returned in case there is no condition
# (e.g. warning or error).
},
error = function(cond) {
message(paste("URL does not seem to exist:", url))
message("Here's the original error message:")
message(conditionMessage(cond))
# Choose a return value in case of error
NA
},
warning = function(cond) {
message(paste("URL caused a warning:", url))
message("Here's the original warning message:")
message(conditionMessage(cond))
# Choose a return value in case of warning
NULL
},
finally = {
# NOTE:
# Here goes everything that should be executed at the end,
# regardless of success or error.
# If you want more than one expression to be executed, then you
# need to wrap them in curly brackets ({...}); otherwise you could
# just have written 'finally = <expression>'
message(paste("Processed URL:", url))
message("Some other message at the end")
}
)
}

As i mentioned, i’m no R expert, but the above looks fine.

It’s quiet difficult to debug without being able to see the full log and script.

Might be best to open a support ticket with your reseller where you can share that level of information with them.


Reply