> 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/methods/geterrors.md).

# getErrors()

## `RangeErrors.prototype.getErrors()`

Returns an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of set range errors, where the key is a [unique identification](/draft-5/getting-started/basic-concepts.md#unique-identification).

{% code title="range-errors.class.ts" %}

```typescript
public getErrors(): { [Key in Id]: RangeError<Key> | undefined } {
  return Object.fromEntries(this.errors.entries()) as any;
}
```

{% endcode %}

### Return type

#### `{ [`<mark style="color:green;">`Key`</mark>`in`[<mark style="color:green;">`Id`</mark>](/draft-5/rangeerrors/generic-type-variables.md#rangeerrors-less-than-id-greater-than)`]: RangeError<`<mark style="color:green;">`Key`</mark>`> |`<mark style="color:green;">`undefined`</mark>` ``}`

The **return type** is an object of the  [`RangeError`](/draft-5/rangeerror/overview.md) objects or [`undefined`](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined) in the keys of generic type variable [`Id`](/draft-5/rangeerrors/generic-type-variables.md#rangeerrors-less-than-id-greater-than).

### Returns

The **return value** is an [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) of set errors.

## 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 the `RangeError` objects under the given identification numbers.
rangeErrors
  .set(
    'Age is 99',
    'Age must be',
    'RE: 4330',
    9,
    27
  )
  .set('Detected numbers', 'Provide only letters', 'RE: 4331');

/*
Returns
{
  RE: 4330: ...,
  RE: 4331: ...
}
of type
  {
    "RE: 4332": RangeError<"RE: 4332", undefined, undefined> | undefined;
    "RE: 4331": RangeError<"RE: 4331", undefined, undefined> | undefined;
    "RE: 4330": RangeError<"RE: 4330", undefined, undefined> | undefined;
  }
*/
rangeErrors.getErrors();
```


---

# 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/methods/geterrors.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.
