Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 15 additions & 28 deletions files/en-us/web/api/rtcerror/errordetail/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,34 @@ browser-compat: api.RTCError.errorDetail

{{APIRef("WebRTC")}}

The {{domxref("RTCError")}} interface's read-only
**`errorDetail`** property is a string indicating the [WebRTC](/en-US/docs/Web/API/WebRTC_API)-specific error code that occurred.
The **`errorDetail`** read-only property of the {{domxref("RTCError")}} interface is a string indicating the [WebRTC](/en-US/docs/Web/API/WebRTC_API)-specific error code that occurred.

## Value

A read-only string whose value indicates the type of WebRTC-specific error that
occurred on an {{domxref("RTCPeerConnection")}}. The possible values are:
A read-only string whose value indicates the type of WebRTC-specific error that occurred on an {{domxref("RTCPeerConnection")}}.
The possible values are:

- `data-channel-failure`
- : The connection's {{domxref("RTCDataChannel")}} has failed.
- `dtls-failure`
- : The negotiation of the {{Glossary("DTLS")}} connection failed, or the connection was
terminated with a fatal error. The error's {{domxref("DOMException.message", "message")}}
contains details about the nature of the error. If a fatal error is _received_,
the error object's {{domxref("RTCError.receivedAlert", "receivedAlert")}} property is
set to the value of the DTLSL alert received. If, on the other hand, a fatal error was
_sent_, the {{domxref("RTCError.sentAlert", "sentAlert")}} is set to the
alert's value.
- : The negotiation of the {{Glossary("DTLS")}} connection failed, or the connection was terminated with a fatal error.
The error's {{domxref("DOMException.message", "message")}} contains details about the nature of the error.
If a fatal error is _received_, the error object's {{domxref("RTCError.receivedAlert", "receivedAlert")}} property is set to the value of the DTLSL alert received.
If, on the other hand, a fatal error was _sent_, the {{domxref("RTCError.sentAlert", "sentAlert")}} is set to the alert's value.
- `fingerprint-failure`
- : The remote certificate for the {{domxref("RTCDtlsTransport")}} didn't match any of
the fingerprints listed in the SDP. If the remote peer can't match the local
certificate against the provided fingerprints, this error doesn't occur, though this
situation may result instead in a `dtls-failure` error.
- : The remote certificate for the {{domxref("RTCDtlsTransport")}} didn't match any of the fingerprints listed in the SDP.
If the remote peer can't match the local certificate against the provided fingerprints, this error doesn't occur, though this situation may result instead in a `dtls-failure` error.
- `hardware-encoder-error`
- : The hardware encoder doesn't support the given configuration parameters.
- `hardware-encoder-not-available`
- : The hardware encoder resources required to accomplish the requested operation aren't
available.
- : The hardware encoder resources required to accomplish the requested operation aren't available.
- `sctp-failure`
- : The {{Glossary("SCTP")}} negotiation has failed, or the connection has terminated
with a fatal error. The SCTP cause code can be found in the `RTCError`
object's {{domxref("RTCError.sctpCauseCode", "sctpCauseCode")}}. SCTP error cause
codes 1-13 are defined in the SCTP specification: {{RFC(4960, "", "3.3.10")}}.
- : The {{Glossary("SCTP")}} negotiation has failed, or the connection has terminated with a fatal error.
The SCTP cause code can be found in the `RTCError` object's {{domxref("RTCError.sctpCauseCode", "sctpCauseCode")}}.
SCTP error cause codes 1-13 are defined in the SCTP specification: {{RFC(4960, "", "3.3.10")}}.
- `sdp-syntax-error`
- : The SDP syntax is invalid. The error's {{domxref("RTCError.sdpLineNumber", "sdpLineNumber")}}
property indicates the line number within the SDP at which the
error was detected.

## Examples

tbd
- : The SDP syntax is invalid.
The error's {{domxref("RTCError.sdpLineNumber", "sdpLineNumber")}} property indicates the line number within the SDP at which the error was detected.

## Specifications

Expand Down
42 changes: 23 additions & 19 deletions files/en-us/web/api/rtcerror/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ browser-compat: api.RTCError

{{APIRef("WebRTC")}}

The **`RTCError`** interface describes an error which has occurred while handling [WebRTC](/en-US/docs/Web/API/WebRTC_API) operations. It's based upon the standard {{domxref("DOMException")}} interface that describes general DOM errors.
The **`RTCError`** interface of the [WebRTC API](/en-US/docs/Web/API/WebRTC_API) describes an error which has occurred while handling RTC operations.
It's based upon the standard {{domxref("DOMException")}} interface that describes general DOM errors.

{{InheritanceDiagram}}

Expand All @@ -18,26 +19,35 @@ The **`RTCError`** interface describes an error which has occurred while handlin

## Instance properties

_In addition to the properties defined by the parent interface, {{domxref("DOMException")}}, `RTCError` includes the following properties:_
_Also inherits properties from its parent interface, {{DOMxRef("DOMException")}}_
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[markdownlint] reported by reviewdog 🐶
error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Also inherits properties from ..."]


- {{domxref("RTCError.errorDetail", "errorDetail")}} {{ReadOnlyInline}}
- : A string specifying the WebRTC-specific error code identifying the type of error that occurred.
- {{domxref("RTCError.receivedAlert", "receivedAlert")}} {{ReadOnlyInline}}
- : An unsigned long integer value indicating the fatal {{Glossary("DTLS")}} error which was received from the network. Only valid if the `errorDetail` string is `dtls-failure`. If `null`, no DTLS error was received.
- : A positive integer value indicating the fatal {{Glossary("DTLS")}} error which was received from the network.
Only valid if the `errorDetail` string is `dtls-failure`.
If `null`, no DTLS error was received.
- {{domxref("RTCError.sctpCauseCode", "sctpCauseCode")}} {{ReadOnlyInline}}
- : If `errorDetail` is `sctp-failure`, this property is a long integer specifying the {{Glossary("SCTP")}} cause code indicating the cause of the failed SCTP negotiation. `null` if the error isn't an SCTP error.
- : An integer specifying the {{Glossary("SCTP")}} cause code indicating the cause of the failed SCTP negotiation.
Set if `errorDetail` is `sctp-failure`.
`null` if the error isn't an SCTP error.
- {{domxref("RTCError.sdpLineNumber", "sdpLineNumber")}} {{ReadOnlyInline}}
- : If `errorDetail` is `sdp-syntax-error`, this property is a long integer identifying the line number of the {{Glossary("SDP")}} on which the syntax error occurred. `null` if the error isn't an SDP syntax error.
- : An integer identifying the line number of the {{Glossary("SDP")}} on which the syntax error occurred.
Set if `errorDetail` is `sdp-syntax-error`.
`null` if the error isn't an SDP syntax error.
- {{domxref("RTCError.sentAlert", "sentAlert")}} {{ReadOnlyInline}}
- : If `errorDetail` is `dtls-failure`, this property is an unsigned long integer indicating the fatal DTLS error that was sent out by this device. If `null`, no DTLS error was transmitted.
- : A positive integer indicating the fatal DTLS error that was sent out by this device.
Set if `errorDetail` is `dtls-failure`.
If `null`, no DTLS error was transmitted.

> [!NOTE]
> All `RTCError` objects have their {{domxref("DOMException.name", "name")}} set to `OperationError`.

## Examples

In this example, a handler is established for an {{domxref("RTCDataChannel")}}'s
{{domxref("RTCDataChannel.error_event", "error")}} event.
### Basic usage

In this example, a handler is established for an {{domxref("RTCDataChannel")}}'s {{domxref("RTCDataChannel.error_event", "error")}} event.

```js
dataChannel.addEventListener("error", (event) => {
Expand All @@ -55,19 +65,13 @@ dataChannel.addEventListener("error", (event) => {
});
```

If the error is an SDP syntax error—indicated by its {{domxref("RTCError.errorDetail", "errorDetail")}}
property being `sdp-syntax-error`—, a message string is
constructed to present the error message and the line number within the SDP at which the
error occurred. This message is then displayed using a function called
`showMyAlertMessage()`, which stands in for whatever output mechanism this
code might use.
If the error is an SDP syntax error—indicated by its {{domxref("RTCError.errorDetail", "errorDetail")}} property being `sdp-syntax-error`—, a message string is constructed to present the error message and the line number within the SDP at which the error occurred.
This message is then displayed using a function called `showMyAlertMessage()`, which stands in for whatever output mechanism this code might use.

Any other error is treated as terminal, causing a `terminateMyConnection()`
function to be called.
Any other error is treated as terminal, causing a `terminateMyConnection()` function to be called.

The above example uses {{domxref("EventTarget.addEventListener", "addEventListener()")}}
to add the handler for `error` events. You can also use the `RTCDataChannel` object's
{{domxref("RTCDataChannel.error_event", "onerror")}} event handler property, like this:
The above example uses {{domxref("EventTarget.addEventListener", "addEventListener()")}} to add the handler for `error` events.
You can also use the `RTCDataChannel` object's {{domxref("RTCDataChannel.error_event", "onerror")}} event handler property, like this:

```js
dataChannel.onerror = (event) => {
Expand Down
11 changes: 3 additions & 8 deletions files/en-us/web/api/rtcerror/receivedalert/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@ browser-compat: api.RTCError.receivedAlert

{{APIRef("WebRTC")}}

The {{domxref("RTCError")}} read-only property
**`receivedAlert`** specifies the fatal {{Glossary("DTLS")}}
error which resulted in an alert being received from the remote peer.
The **`receivedAlert`** read-only property of the {{domxref("RTCError")}} interface specifies the fatal {{Glossary("DTLS")}} error which resulted in an alert being received from the remote peer.

## Value

An unsigned long integer value specifying the fatal {{Glossary("DTLS")}} error which
resulted in an alert being received from the remote peer.
A positive integer value specifying the fatal {{Glossary("DTLS")}} error which resulted in an alert being received from the remote peer.

> [!NOTE]
> This property is `null` if the `RTCError` doesn't represent a
> DTLS error (with {{domxref("RTCError.errorDetail", "errorDetail")}} set to
> `dtls-failure`).
> This property is `null` if the `RTCError` doesn't represent a DTLS error (with {{domxref("RTCError.errorDetail", "errorDetail")}} set to `dtls-failure`).

## Specifications

Expand Down
84 changes: 84 additions & 0 deletions files/en-us/web/api/rtcerror/rtcerror/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: "RTCError: RTCError() constructor"
short-title: RTCError()
slug: Web/API/RTCError/RTCError
page-type: web-api-constructor
browser-compat: api.RTCError.RTCError
---

{{APIRef("WebRTC")}}

The **`RTCError()`** constructor creates and returns a new {{domxref("RTCError")}} object initialized with the different parameters and, optionally, a string to use as the value of the error's message property.

## Syntax

```js-nolint
new RTCError(options)
new RTCError(options, message)
```

### Parameters

- `options`
- : An object that can be provided to set the details of the specific error in an RTCErrorEvent.
The object has the following properties:
- `errorDetail`
- : A string specifying the WebRTC-specific error code identifying the type of error that occurred.
This will be one of:
- `data-channel-failure`
- : The connection's {{domxref("RTCDataChannel")}} has failed.
- `dtls-failure`
- : The negotiation of the {{Glossary("DTLS")}} connection failed, or the connection was terminated with a fatal error.
The error's {{domxref("DOMException.message", "message")}} contains details about the nature of the error.
- If a fatal error is _received_, set [`receivedAlert`](#receivedalert) to the value of the received DTLSL alert.
- If a fatal error was _sent_, set [`sentAlert`](#sentalert) to the alert's value.
- `fingerprint-failure`
- : The remote certificate for the {{domxref("RTCDtlsTransport")}} didn't match any of the fingerprints listed in the SDP.
If the remote peer can't match the local certificate against the provided fingerprints, this error doesn't occur, though this situation may result instead in a `dtls-failure` error.
- `hardware-encoder-error`
- : The hardware encoder doesn't support the given configuration parameters.
- `hardware-encoder-not-available`
- : The hardware encoder resources required to accomplish the requested operation aren't available.
- `sctp-failure`
- : The {{Glossary("SCTP")}} negotiation has failed, or the connection has terminated with a fatal error.
The SCTP cause code should be set in [`sctpCauseCode`](#sctpcausecode).
SCTP error cause codes 1-13 are defined in the SCTP specification: {{RFC(4960, "", "3.3.10")}}.
- `sdp-syntax-error`
- : The SDP syntax is invalid.
The line number within the SDP at which the error was detected should be set in [`sdpLineNumber`](#sdplinenumber).

- `receivedAlert` {{optional_inline}}
- : A positive integer value indicating a fatal {{Glossary("DTLS")}} error that was received from the network.
Only set if the `errorDetail` string is `dtls-failure`.

- `sctpCauseCode` {{optional_inline}}
- : An integer specifying the {{Glossary("SCTP")}} cause code that indicates the cause of the failed SCTP negotiation.
This should only be set if `errorDetail` is `sctp-failure`.

- `sdpLineNumber` {{optional_inline}}
- : An integer identifying the line number of the {{Glossary("SDP")}} on which a syntax error occurred.
Only set if `errorDetail` is `sdp-syntax-error`.
- `sentAlert` {{optional_inline}}
- : A positive integer indicating s fatal DTLS error that was sent out by this device.
Only set is `errorDetail` is `dtls-failure`.

- `message` {{optional_inline}}
- : A string for the error message.
Defaults to the empty string (`""`).

### Return value

A newly-created {{domxref("RTCError")}} object.
The properties of the object are set to the values passed in the [`options`](#options) parameter, or otherwise `null`.

## Usage notes

This constructor does not do complete validation of the specified `candidateInfo` object or string.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
13 changes: 4 additions & 9 deletions files/en-us/web/api/rtcerror/sctpcausecode/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@ browser-compat: api.RTCError.sctpCauseCode

{{APIRef("WebRTC")}}

The read-only **`sctpCauseCode`** property in an
{{domxref("RTCError")}} object provides the {{Glossary("SCTP")}} cause code explaining
why the SCTP negotiation failed, if the `RTCError` represents an SCTP error.
The **`sctpCauseCode`** read-only property of the {{domxref("RTCError")}} interface provides the {{Glossary("SCTP")}} cause code explaining why the SCTP negotiation failed, if the `RTCError` represents an SCTP error.

## Value

An unsigned long integer value specifying SCTP cause code explaining why the error
occurred. This property is `null` if the error isn't an SCTP error, with its
{{domxref("RTCError.errorDetail", "errorDetail")}} property set to
`sctp-failure`.
An unsigned long integer value specifying SCTP cause code explaining why the error occurred.
This property is `null` if the error isn't an SCTP error, with its {{domxref("RTCError.errorDetail", "errorDetail")}} property set to `sctp-failure`.

The standard SCTP error cause codes, numbered 1-13, are defined in the SCTP
specification: {{RFC(4960, "", "3.3.10")}}.
The standard SCTP error cause codes, numbered 1-13, are defined in the SCTP specification: {{RFC(4960, "", "3.3.10")}}.

## Specifications

Expand Down
12 changes: 4 additions & 8 deletions files/en-us/web/api/rtcerror/sdplinenumber/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ browser-compat: api.RTCError.sdpLineNumber

{{APIRef("WebRTC")}}

The {{domxref("RTCError")}} interface's read-only property
**`sdpLineNumber`** specifies the line number within the
{{Glossary("SDP")}} at which a syntax error occurred while parsing it.
The **`sdpLineNumber`** read-only property of the {{domxref("RTCError")}} interface specifies the line number within the {{Glossary("SDP")}} at which a syntax error occurred while parsing it.

## Value

An unsigned integer value indicating the line within the SDP at which the syntax error
described by the `RTCError` object occurred. The lines are numbered starting
with line 1.
An integer value indicating the line within the SDP at which the syntax error described by the `RTCError` object occurred.
The lines are numbered starting with line 1.

This property is `null` unless the value of
{{domxref("RTCError.errorDetail", "errorDetail")}} is `sdp-syntax-error`.
This property is `null` unless the value of {{domxref("RTCError.errorDetail", "errorDetail")}} is `sdp-syntax-error`.

## Specifications

Expand Down
10 changes: 3 additions & 7 deletions files/en-us/web/api/rtcerror/sentalert/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ browser-compat: api.RTCError.sentAlert

{{APIRef("WebRTC")}}

The read-only **`sentAlert`** property in an
{{domxref("RTCError")}} object specifies the {{Glossary("DTLS")}} alert number occurred
while sending data to the remote peer, if the error represents an outbound DTLS error.
The **`sentAlert`** read-only property of the {{domxref("RTCError")}} interface specifies the {{Glossary("DTLS")}} alert number occurred while sending data to the remote peer, if the error represents an outbound DTLS error.

## Value

An unsigned integer value providing the DTLS alert number corresponding to the DTLS
error which was sent to the remote peer, as represented by this `RTCError`
object. This property is `null` if {{domxref("RTCError.errorDetail", "errorDetail")}}
isn't `dtls-failure`.
A positive integer value providing the DTLS alert number corresponding to the DTLS error which was sent to the remote peer, as represented by this `RTCError` object.
This property is `null` if {{domxref("RTCError.errorDetail", "errorDetail")}} isn't `dtls-failure`.

## Specifications

Expand Down
Loading
Loading