Abort

Tests for a parameter's existence, tests its data type, and, if a default value is not assigned, optionally provides one.

Component Signature

<bx:Abort showerror=[string]
type=[string] />

Attributes

Atrribute
Type
Required
Description
Default

showerror

string

false

Whether to show an error

type

string

false

The type of the abort (request or page)

request

Examples

Example of using abort() to stop processing after an error occurs

In this example we demonstrate using the abort() function to stop any further processing after we deliberately call a non-existent function.

Run Example

try {
	// make a call to a non-existent function
	firstName = userService.getUserById( 1 ).getFirstName();
}
// catch any errors
 catch (any e) {
	// dump the error to the browser
	writeDump( e );
	// abort further processing
	bx:abort;
}

Result: Error page: Variable USERSERVICE is undefined.

Example of using bx:abort to stop processing after an error occurs

In this example we demonstrate using the bx:abort tag to stop any further processing after we deliberately call a non-existent function.

<bx:try>
	<!--- make a call to a non-existent function --->
	<bx:set firstName = userService.getUserById( 1 ).getFirstName() >
<!--- catch any errors --->

<bx:catch type="any">
	<!--- dump the error to the browser --->
	<bx:dump var="#bxcatch#">
	<!--- abort further processing --->
	<bx:abort>
</bx:catch></bx:try>

Result: Error page: Variable USERSERVICE is undefined.

Last updated

Was this helpful?