---
title: XPathException.code
slug: Web/API/XPathException/code
tags:
  - API
  - DOM
  - DOM XPath API
  - Property
  - Reference
  - XPath
  - XPathException
browser-compat: api.XPathException.code
---
{{APIRef("DOM XPath")}}{{Deprecated_Header}}

The **`code`** read-only property of the
{{domxref("XPathException")}} interface returns a `short` that contains one
of the [error code constants](/en-US/docs/Web/API/XPathException#Constants).

## Syntax

```js
var exceptionCode = exception.code;
```

### Value

A `short` number representing the error code.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
