phoenicis icon indicating copy to clipboard operation
phoenicis copied to clipboard

Enhance include System with more detailed Exceptions

Open madoar opened this issue 5 years ago • 2 comments

Currently when an included script throws an error the shown error message doesn't tell the user where the error occurred, i.e. in which script the error occurred. We should add this information to the shown error message to ensure script developers an easier time fixing their scripts.

madoar avatar Aug 11 '19 10:08 madoar

Can you give more detailed information on how this could be done?

plata avatar Aug 12 '19 17:08 plata

In theory we only need to execute

https://github.com/PhoenicisOrg/phoenicis/blob/727481fa7ee714125539b96c12002add7e50fc4f/phoenicis-scripts/src/main/java/org/phoenicis/scripts/engine/injectors/IncludeInjector.java#L36-L43

in a try/catch block.

When catching an exception in this block we can then wrap it in a new ScriptIncludeException which we then again throw. This new ScriptIncludeException should contain a scriptId field, that contains information about the script in which the exception occurred.

madoar avatar Aug 12 '19 17:08 madoar