> For the complete documentation index, see [llms.txt](https://error.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://error.angular-package.dev/draft-5/rangeerrors/example-usage.md).

# Example usage

```typescript
// Example usage.
import { RangeErrors } from '@angular-package/error';

// Define range errors.
const rangeErrors = new RangeErrors('(RE: 4332)', '(RE: 4331)', '(RE: 4330)');
```

### `set()`

```typescript
// Set the `RangeError` objects under the given identification numbers.
rangeErrors
  .set('Age is 99', 'Age must be ', '(RE: 4330)', 9, 27)
  .set('Height can not be 11000', 'Set height ', '(RE: 4331)', 1, 1000)
  .set('Width can not be 300', 'Set width ', '(RE: 4331)', 1080, 1920);
```

### `delete()`

```typescript
// Example `delete()` method usage.
rangeErrors.delete('(RE: 4332)');
```

### `get()`

```typescript
// Example `get()` usage.

// Returns `undefined`.
rangeErrors.get('(RE: 4332)');

// Returns
// RangeError: Problem(RE: 4331): Width can not be 300 => Fix: Set width  between 1080 and 1920
rangeErrors.get('(RE: 4331)');
```

### `has()`

```typescript
// Example `has()` usage.

// Returns `false`.
rangeErrors.has('(RE: 4332)');

// Returns `true`.
rangeErrors.has('(RE: 4331)');
```

### `throw()`

```typescript
// Example `throw()` usage.
try {
  rangeErrors.throw('(RE: 4330)');
} catch (e) {
  if (RangeError.isRangeError(e)) {
    e.fix; // Age must be
    e.message; // Problem(RE: 4330): Age is 99 => Fix: Age must be  between 9 and 27
    e.name; // RangeError
    e.problem; // Age is 99
    e.template; // Problem{id}: {problem} => Fix: {fix} between {min} and {max}
    e.id; // (RE: 4330)
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://error.angular-package.dev/draft-5/rangeerrors/example-usage.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.
