cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
shuey
Level II

Best practices for error handling with Include() calls in large JSL projects?

I'm working on a large JSL project that uses many Include() calls to organize the code. I've run into an issue where if one of the included scripts fails, the main script continues executing, which can lead to cascading errors or unexpected behavior.

Currently, I'm considering restructuring my includes to only contain function definitions rather than executable code. The idea is that if an include fails during the definition phase, subsequent calls to those functions would fail more explicitly.

However, I'm wondering if there are better practices for handling this situation. Specifically:

  1. Is there a way to make Include() halt execution if the included script encounters an error?
  2. Is separating function definitions from executable code the recommended approach, or are there other architectural patterns that work better for large JSL projects?

I'd appreciate any insights on how others structure their JSL projects to handle include dependencies robustly.

1 REPLY 1
jthi
Super User

Re: Best practices for error handling with Include() calls in large JSL projects?

I think one option is to wrap your includes with Try()

 

test1.jsl

Names Default To Here(1);

show

test2.jsl

Names Default To Here(1);

Try(
	Include("test1.jsl");
,
	Throw(Char(exception_msg));
);

Show("not executed");
-Jarmo

Recommended Articles