Class: Error

bemap.Error(options)

Error class for the BeMap JS API. Constructor signature is fully backward-compatible with v1.0 (the existing `code` / `message` fields are preserved and behave identically). Version 1.5.0 adds three optional fields (`status`, `url`, `context`) for richer error reporting from the modernised services, plus a set of named code constants on the class for convenience.

Constructor

new Error(options)

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Description
code String <optional>
Error code (e.g. 'UNAUTHORIZED', 'NETWORK', 'ROUTING_NO_ROUTE').
message String <optional>
Human-readable error message.
status Number <optional>
HTTP status when the error came from an HTTP response.
url String <optional>
Request URL when applicable.
context Object <optional>
Additional debug payload (parsed response, engine-specific info).
Source:

Members

(protected) code :String

Type:
  • String
Source:

(protected) context :Object

Free-form debug context (parsed response body, engine-specific debug info, etc.).
Type:
  • Object
Since:
  • 1.5.0
Source:

(protected) message :String

Type:
  • String
Source:

(protected) status :Number

HTTP status code if the error came from an HTTP response, otherwise null.
Type:
  • Number
Since:
  • 1.5.0
Source:

(protected) url :String

Request URL associated with the error, when applicable.
Type:
  • String
Since:
  • 1.5.0
Source:

Methods

getCode() → {String}

Get the code of the error.
Source:
Returns:
code
Type
String

getContext() → {Object|null}

Get the free-form context object associated with the error, or null.
Since:
  • 1.5.0
Source:
Returns:
context
Type
Object | null

getMessage() → {String}

Get the message of the error.
Source:
Returns:
message
Type
String

getStatus() → {Number|null}

Get the HTTP status of the error, or null if not HTTP-originated.
Since:
  • 1.5.0
Source:
Returns:
status
Type
Number | null

getUrl() → {String|null}

Get the request URL associated with the error, or null.
Since:
  • 1.5.0
Source:
Returns:
url
Type
String | null