Knowledge Base
Examples
Quick Start Guides

Building a Custom Error Handler that Emails the Error Details


If you would like to create a custom error handler that will e-mail you directly, you will want to add the following to your Mail Action's pre-script.

String BodyText = "\n";

String SubjectText;  
FlowChart myChart = flowContext.getFlowChart();  
String myChartName = myChart.getName();
String throwingActionName = flowContext.getErrorResult().throwingAction;
String curActionName = flowContext.getActionName();
String message = flowContext.getErrorResult().message;
String stackTrace = flowContext.getErrorResult().stackTrace;  
SubjectText = "Flux Error: " + myChartName + " failed";  
BodyText = BodyText + "There was an error in flowchart " + myChartName;
BodyText = BodyText + " during action \"" + throwingActionName +"\"" +"\n";
BodyText = BodyText + " The error was \"" + message + "\" \n" + "\n";
BodyText = BodyText + "The stack trace is: \n"; BodyText = BodyText + stackTrace + "\n";   myChart.getAction(curActionName).setBody(BodyText);
myChart.getAction(curActionName).setSubject(SubjectText);

Thanks to Seth Parker @ By Baxter for sending us this script!