Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of assert failures in event handlers #4392

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
*/
package net.rptools.maptool.client.functions.exceptions;

import net.rptools.parser.function.ParameterException;
import net.rptools.parser.ParserException;

/** Exception type thrown by assert() function, allowing a user-defined error message. */
public class AssertFunctionException extends ParameterException {
public class AssertFunctionException extends ParserException {
public AssertFunctionException(String msg) {
super(msg);
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/rptools/maptool/util/EventMacroUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ public static MapToolVariableResolver callEventHandler(
}
} catch (AbortFunctionException afe) {
// Do nothing
} catch (AssertFunctionException e) {
MapTool.addLocalMessage(e.getMessage());
} catch (ParserException | ExecutionException | InterruptedException e) {
MapTool.addLocalMessage(
I18N.getText(
Expand Down Expand Up @@ -289,6 +291,8 @@ public static MapToolVariableResolver callEventHandlerOld(
}
} catch (AbortFunctionException afe) {
// Do nothing
} catch (AssertFunctionException e) {
MapTool.addLocalMessage(e.getMessage());
} catch (ParserException e) {
MapTool.addLocalMessage(
"Event continuing after error running " + macroTarget + ": " + e.getMessage());
Expand Down
Loading