Advanced Customization > Info*Engine User’s Guide > Task Webject Reference > Management Webjects > Throw-Exception
  
Throw-Exception
DESCRIPTION
Causes an exception to be thrown. If the webject is called from within the body of a unit within a task, control is transferred to a failure block, if the block exists. If the webject is called from outside of a unit, the task exits.
* 
Info*Engine arranges for the names and messages of exceptions thrown during task execution to be registered automatically in the SERVER context group attributes named exception-class and exception-message. This makes it possible for failure blocks within units to process exceptions and then re-throw them by calling the Throw-Exception webject without passing on any parameters. The SERVER context attribute named exception-object unwraps nested exceptions and creates the registers the raw, unwrapped exception object. The Throw-Exception webject looks for this SERVER context attribute and, if present, throw the associated exception object directly.
SYNTAX
<ie:webject name="Throw-Exception" type="MGT">
  <ie:param name="BUNDLE" data="bundle_name"/>
  <ie:param name="CLASS" data="exception_class_name"/>
  <ie:param name="GROUP_IN" data="input_group"/>
  <ie:param name="KEY" data="resource_key"/>
  <ie:param name="MESSAGE" data="text_message"/>
  <ie:param name="PARAM" data="resource_param"/>
</ie:webject>
PARAMETERS
Required
Select
Optional
BUNDLE
CLASS
GROUP_IN
KEY
MESSAGE
PARAM
BUNDLE
Identifies the class name of a Java resource bundle containing localized message templates to be associated with the exception.
To use the KEY and PARAM parameters, you must also specify either BUNDLE or GROUP_IN.
CLASS
Specifies the Java class name of the exception to be thrown. If CLASS is omitted, the webject obtains the class name from the SERVER context group attribute named exception-class. If the attribute does not exist, the class name defaults to com.infoengine.util.IEException. This parameter is optional.
GROUP_IN
Identifies a group containing localized resource definitions, such as the group produced by the Get-Resource webject. If both BUNDLE and GROUP_IN are specified, BUNDLE takes precedence, and GROUP_IN is ignored.
To use the KEY and PARAM parameters, you must also specify either BUNDLE or GROUP_IN.
KEY
Selects a localized message template from the bundle or group. The KEY value may be specified as a number or a Java variable reference name.
This parameter is used only when you also specify either the BUNDLE or GROUP_IN parameter.
MESSAGE
The MESSAGE parameter specifies the textual message to be associated with the exception. Use this parameter only when it is not necessary to generate localizable messages in exceptions. If this parameter is omitted and the BUNDLE and GROUP_IN parameters are also omitted, the webject obtains message text from the SERVER context group attribute named exception-message. If BUNDLE or GROUP_IN are specified in addition to MESSAGE, the MESSAGE parameter takes precedence while BUNDLE and GROUP_IN are ignored.
PARAM
Supplies one or more values that are substituted into the localized message template to produce the final message text. If PARAM is not specified, it is assumed that the message template identified by the BUNDLE or GROUP_IN and the KEY parameters does not contain any substitution keywords, thus no substitution is performed.
This parameter is used only when you also specify either the BUNDLE or GROUP_IN parameter.
EXAMPLE
The following Throw-Exception example JSP page throws an exception using the localized message identified by KEY number 19 in the specified resource bundle:
<%@page language="java"
  session="false"
  errorPage="../IEError.jsp"%>
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core"
                                              prefix="ie" %>

html>
<head><title>Throw Exception</title></head>
<body>

ie:webject name="Throw-Exception" type="MGT">
  <ie:param name="BUNDLE"
                     data="com.infoengine.util.IEResource"/>
  <ie:param name="KEY" data="19"/>
</ie:webject>

/body>
</html>