cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Service Failure

Rmcrabb
9-Granite

Service Failure

I have a service retrieving a json file from several devices via the contentloaderfunction getjson. After the json is retrieved I parse the data and output an infotable and display the values in a mashup. If the service fails the widgets displaying the data show errors on my mashup. I would prefer to show no data vs an errored widget. Is there anyway to have the service return an empty infotable?

1 ACCEPTED SOLUTION

Accepted Solutions

Place the script of your service in a try catch and have an empty table equal to the result of your script if it goes into the catch. for example:

 

try {
//insert current script here

result = PopulatedInfotable
}
catch(err) {

result = emptyInfoTable
}}

 

Hope that helps

View solution in original post

2 REPLIES 2
pgrodowski
13-Aquamarine
(To:Rmcrabb)

Hello,

 

I can see 2 possible solutions to not store errors in the infotable.

The first that comes to my mind is a workaround, you could do a regular expression match on the values after they have been fetched. The regular expression should match a common term in the error messages, like "error" or "warning". If the expression matches you don't store it in the infotable.

 

The second would be to check for possible errors while receiving, in case of error, to not use the variable for Infotable input. I haven't tested this however.

 

Regards,

Pascal

Place the script of your service in a try catch and have an empty table equal to the result of your script if it goes into the catch. for example:

 

try {
//insert current script here

result = PopulatedInfotable
}
catch(err) {

result = emptyInfoTable
}}

 

Hope that helps

Top Tags