diff --git a/Sources/WebDriver/ErrorResponse.swift b/Sources/WebDriver/ErrorResponse.swift index 7db02c5..8e19113 100644 --- a/Sources/WebDriver/ErrorResponse.swift +++ b/Sources/WebDriver/ErrorResponse.swift @@ -1,7 +1,17 @@ -public struct ErrorResponse: Codable, Error { +/// A response received when an error occurs when processing a request. +public struct ErrorResponse: Codable, Error, CustomStringConvertible { public var status: Status public var value: Value + public var description: String { + var str = "Error \(status.rawValue)" + if let error = value.error { + str += " (\(error))" + } + str += ": \(value.message)" + return str + } + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#response-status-codes public struct Status: Codable, Hashable, RawRepresentable { public var rawValue: Int