# ServiceAuthorizationError

## ServiceAuthorizationError <a href="#serviceauthorizationerror" id="serviceauthorizationerror"></a>

### new ServiceAuthorizationError(args)

| Param              | Type     | Default               | Description                                                 |
| ------------------ | -------- | --------------------- | ----------------------------------------------------------- |
| args               | `Object` |                       | **Required -** The args object passed to the constructor    |
| args.publicData    | `Object` |                       | **Required -** Data to show in the error                    |
| args.internalData  | `Object` |                       | **Required -** Private data that can be logged in the error |
| args.publicMessage | `string` | `"An error occurred"` | Error message to be shown                                   |
| args.httpCode      | `number` | `500`                 | Http status code for error                                  |

## hapiReply(replyOrResponseToolkit, \[extraPublicData]) ⇒ `Object` <a href="#hapireply" id="hapireply"></a>

Reply function to respond with the error

**Returns**: `Object` - Response - Response object

| Param                  | Type     | Default | Description                                                                           |
| ---------------------- | -------- | ------- | ------------------------------------------------------------------------------------- |
| replyOrResponseToolkit | `Object` |         | **Required -** Response toolkit - For example 'h' in Hapi, which handles the response |
| extraPublicData        | `Object` | `{}`    | Extra public data to shown in the error message                                       |


---

# 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://docs.navigaglobal.com/navigaid/shared-modules/service-authorization-lib/serviceauthorizationerror.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.
