Project: Birt
Bug 267120 Support User Defined Exceptions from Event Handlers
Reported: 2009-03-04 16:43:59 | Status: resolved fixed

When writing event handlers, the developer may find conditions that can not be resolved from the code. It does not seem like there is a way to throw an Exception back to the ReportEngine in the case of an error. Ideally, all of the EventHandler methods would have the ability to throw a Java Exception back into the report engine. This could either be done by adding the message to the ReportContext (which seem really contrived) or better by throwing an exception class IUserDefinedException extends BirtException{ public IUserDefinedException (ScriptableObject scriptObj, Sting msg, (optional)Throwable cause, (optional)severity) } The biggest difference is that the UserDefinedException does not need to have access to the pluginId or the ResourceBundles as this information is not readily available to most script developers. The ReportEngine would obey standard severity rules and would display the message in the report output for HTML reports.

Files changed in fix:
core/org.eclipse.birt.core/src/org/eclipse/birt/core/exception/BirtException.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/ScriptException.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/AutoTextEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/CellEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/DataItemEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/DataSetEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/DataSourceEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/DynamicTextEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/GridEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/ImageEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/LabelEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/ListEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/ListGroupEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/ReportEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/RowEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/ScriptedDataSetEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/ScriptedDataSourceEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/TableEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/TableGroupEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventadapter/TextItemEventAdapter.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IAutoTextEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/ICellEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IDataItemEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IDataSetEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IDataSourceEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IDynamicTextEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IGridEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IImageEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/ILabelEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IListEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IListGroupEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IReportEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IRowEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IScriptedDataSetEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/IScriptedDataSourceEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/ITableEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/ITableGroupEventHandler.java engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/eventhandler/ITextItemEventHandler.java