---
title: "GeolocateErrorEvent | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Class GeolocateErrorEvent

The event class for the geolocate control `error` event. Carries the [PositionError](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError) returned by the Geolocation API.

#### Hierarchy ([View Summary](https://docs.maptiler.com/sdk-js/api-reference/hierarchy/#GeolocateErrorEvent))

-   [Event](https://docs.maptiler.com/sdk-js/api-reference/classes/Event/)
    -   GeolocateErrorEvent

##### Index

### Constructors

[constructor](#constructor)

### Properties

[code](#code) [message](#message) [target](#target) [type](#type)

## Constructors

### constructor[](#constructor)

-   new GeolocateErrorEvent(type: string, data?: object): GeolocateErrorEvent[](#constructorgeolocateerrorevent)
    
    #### Parameters
    
    -   type: string
    -   `Optional`data: object
    
    #### Returns GeolocateErrorEvent
    
    Inherited from [Event](https://docs.maptiler.com/sdk-js/api-reference/classes/Event/).[constructor](https://docs.maptiler.com/sdk-js/api-reference/classes/Event/#constructor)
    

## Properties

### code[](#code)

code: number

The error code returned by the Geolocation API.

### message[](#message)

message: string

The error message returned by the Geolocation API.

### target[](#target)

target: [GeolocateControlMLGL](https://docs.maptiler.com/sdk-js/api-reference/classes/GeolocateControlMLGL/)

The `GeolocateControl` object that fired the event.

Overrides [Event](https://docs.maptiler.com/sdk-js/api-reference/classes/Event/).[target](https://docs.maptiler.com/sdk-js/api-reference/classes/Event/#target)

### type[](#type)

type: "error"

Overrides [Event](https://docs.maptiler.com/sdk-js/api-reference/classes/Event/).[type](https://docs.maptiler.com/sdk-js/api-reference/classes/Event/#type)
