# 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](https://try.boxlang.io/?code=eJw1jrEOwjAMROfkKzymA1SsIBaEkFhYEB%2BQpm4b0SaV49JWiH8nKWXznZ99xzTDW4o8h04%2FETQY3bbAPk7Ouw1ONjA6hmpwhq13UlSWAt90h3CEISDdkV7W4LZGfkR5mq%2Blgh1kybj8WZUd5EfGFKPZNKDdDEjkKcjVUYuVrV3KoeuBG%2FxBqU4SBfkxJkgxkmU8R0YBQvycTnThKdWkSBL05A2GYF0tRTHtl2Vq8AU1S07t)

```java
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.

```java
<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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/components/system/abort.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
