Do something useful when script errors

Post Reply
cwswitch
Member
Posts: 78
Joined: Fri Feb 24, 2017 12:25 am

Do something useful when script errors

Post by cwswitch »

I have scripts that are designed to throw errors

Code: Select all

				if (result !== "Success") {
					throw new Error("Message: " + result);	
				}	
				return result;
				
	}
Can I catch this error in Switch and send the job off elsewhere instead of it just failing at this point?
r.zegwaard
Member
Posts: 93
Joined: Fri Jul 08, 2011 10:31 am
Location: The Netherlands

Re: Do something useful when script errors

Post by r.zegwaard »

If you set the connection-type of the script to "Traffic-light", you can send the job the the success, warning or error-connection, depending of the result of your script.

See http://www.enfocus.com/manuals/Develope ... /home.html
topics:
  • Developing a scripts > Script declaration > Main script properties --- Connection type
  • Scripting reference > Flow element module > Job class --- Sending jobs to outgoing connections
Post Reply