/// <summary>
        /// Sets the status of the session with the specified Id as having an error as an asynchronous operation.
        /// </summary>
        /// <param name="client">The <c>BrowserStack</c> Automate client.</param>
        /// <param name="sessionId">The session Id to set the status of.</param>
        /// <param name="reason">An optional reason to specify.</param>
        /// <returns>
        /// A <see cref="Task{TResult}"/> representing the asynchronous operation to set the status of the session with the specified Id as having an error.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="client"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="sessionId"/> is <see langword="null"/> or white space.
        /// </exception>
        public static async Task <Session> SetSessionErrorAsync(this BrowserStackAutomateClient client, string sessionId, string reason)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            return(await client.SetSessionStatusAsync(sessionId, SessionStatuses.Error, reason));
        }
        /// <summary>
        /// Sets the status of the session with the specified Id as having an error as an asynchronous operation.
        /// </summary>
        /// <param name="client">The <c>BrowserStack</c> Automate client.</param>
        /// <param name="sessionId">The session Id to set the status of.</param>
        /// <param name="reason">An optional reason to specify.</param>
        /// <param name="cancellationToken">The optional cancellation token to use.</param>
        /// <returns>
        /// A <see cref="Task{TResult}"/> representing the asynchronous operation to set the status of the session with the specified Id as having an error.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="client"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="sessionId"/> is <see langword="null"/> or white space.
        /// </exception>
        public static Task <Session> SetSessionErrorAsync(
            this BrowserStackAutomateClient client,
            string sessionId,
            string reason,
            CancellationToken cancellationToken = default)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            return(client.SetSessionStatusAsync(sessionId, SessionStatuses.Error, reason, cancellationToken));
        }