Table of Contents

Class UnhandledErrorCollection

Namespace
WebDriverBiDi.Protocol
Assembly
WebDriverBiDi.dll

The collection of unhandled errors in the protocol transport during execution of a WebDriver BiDi session.

public class UnhandledErrorCollection
Inheritance
UnhandledErrorCollection
Inherited Members

Constructors

UnhandledErrorCollection()

Initializes a new instance of the UnhandledErrorCollection class.

public UnhandledErrorCollection()

Properties

EventHandlerExceptionBehavior

Gets or sets a value indicating the behavior for errors resulting from unhandled exceptions in user-defined event handlers for protocol events.

public TransportErrorBehavior EventHandlerExceptionBehavior { get; set; }

Property Value

TransportErrorBehavior

Exceptions

Gets the list of exceptions for the unhandled errors in the collection, across every error category. An empty collection yields an empty list.

public IList<Exception> Exceptions { get; }

Property Value

IList<Exception>

Remarks

The returned list is a snapshot, disconnected from this collection: it is unaffected by errors added afterwards, and mutating it does not alter the collection. To ask about one TransportErrorBehavior rather than all of them, use TryGetExceptions(TransportErrorBehavior, out IList<Exception>) or HasUnhandledErrors(TransportErrorBehavior).

ProtocolErrorBehavior

Gets or sets a value indicating the behavior for protocol errors: messages recognized as an error response or as a registered event whose payload cannot be deserialized, and unexpected failures while processing an incoming message.

public TransportErrorBehavior ProtocolErrorBehavior { get; set; }

Property Value

TransportErrorBehavior

UnexpectedErrorBehavior

Gets or sets a value indicating the behavior for errors resulting from valid error responses that do not correspond to a command sent by the user.

public TransportErrorBehavior UnexpectedErrorBehavior { get; set; }

Property Value

TransportErrorBehavior

UnknownMessageBehavior

Gets or sets a value indicating the behavior for unknown messages: messages that cannot be parsed as JSON, or that are not a command response for a pending command, an error response, or a registered event.

public TransportErrorBehavior UnknownMessageBehavior { get; set; }

Property Value

TransportErrorBehavior

Methods

AddUnhandledError(UnhandledErrorKind, Exception)

Adds an unhandled error to the collection.

public void AddUnhandledError(UnhandledErrorKind errorType, Exception exception)

Parameters

errorType UnhandledErrorKind

The type of error to add.

exception Exception

The exception that causes the unhandled error.

ClearUnhandledErrors()

Clears the collection of unhandled errors.

public void ClearUnhandledErrors()

HasUnhandledErrors(TransportErrorBehavior)

Gets a value indicating whether the collection contains errors for the specified error behavior.

public bool HasUnhandledErrors(TransportErrorBehavior errorBehavior)

Parameters

errorBehavior TransportErrorBehavior

The error behavior for which to determine if errors exist.

Returns

bool

true if the collection contains errors for the specified behavior; otherwise, false.

TryGetExceptions(TransportErrorBehavior, out IList<Exception>)

Atomically checks whether the collection contains errors for the specified error behavior, and if so, returns a snapshot of the matching exceptions.

public bool TryGetExceptions(TransportErrorBehavior errorBehavior, out IList<Exception> exceptions)

Parameters

errorBehavior TransportErrorBehavior

The error behavior for which to determine if errors exist.

exceptions IList<Exception>

When this method returns true, contains a snapshot of the exceptions; otherwise, an empty, read-only list.

Returns

bool

true if the collection contains errors for the specified behavior; otherwise, false.