cwswitch 							 
						Member 			
		Posts:  99 Joined:  Fri Feb 24, 2017 12:25 am 
		
						
					
													
							
						
									
						Post 
					 
								by cwswitch  Sun Jan 13, 2019 11:35 pm 
			
			
			
			
			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:  364 Joined:  Mon Jun 12, 2017 8:48 pmLocation:  Belgium 
		
						
					
													
							
						
									
						Post 
					 
								by Padawan  Mon Jan 14, 2019 8:39 am 
			
			
			
			
			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() );
	}