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

Service Failure

SOLVED
Level 7

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

Re: Service Failure

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

2 REPLIES 2
Highlighted

Re: Service Failure

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

Re: Service Failure

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