Skip to content

Commit

Permalink
Format errors for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle committed Oct 25, 2024
1 parent 1f70708 commit c3abce7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Sources/WebDriver/ErrorResponse.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit c3abce7

Please sign in to comment.