Pushing errors to Error out

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

Pushing errors to Error out

Post by cwswitch »

Hello,

Can I push any error in a script to the error out connector?

Or must I have a try catch and the catch pushes the error the way I want?

If try/catch was the way, then do I copy the problem bit of code like this?

Code: Select all

	try {
		problem code in its entirety even if it is several lines long;
	} catch (e) {
		job.sendToData( 3, job.getPath() );
	}
Ideally -
What I'd really like is a neat way to capture any error whatsoever and have it push to Error Out
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Pushing errors to Error out

Post by Padawan »

Your code looks like it will work (assuming of course you have set the outgoing connection to be traffic light). Personally, I would add a line to log your exception in the Switch messages.

Code: Select all

	try {
		//problem code in its entirety even if it is several lines long;
	} catch (e) {
		job.log(3, e);
		job.sendToData( 3, job.getPath() );
	}
Post Reply