Skip to content

Commit

Permalink
add initializator to Error
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Jul 17, 2022
1 parent 84acf91 commit 81cf2ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/EverscaleClientSwift/Client/ClientTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,18 @@ public struct TSDKClientError: Codable, Error {
public var message: String
public var localizedDescription: String { self.message }
public var data: AnyValue = [:].toAnyValue()

public init(code: UInt32, message: String, data: AnyValue = [:].toAnyValue()) {
self.code = code
self.message = message
self.data = data
}

public init(_ error: Error) {
self.code = 0
self.message = error.localizedDescription
self.data = [:].toAnyValue()
}
}

public struct TSDKClientConfig: Codable {
Expand Down

0 comments on commit 81cf2ca

Please sign in to comment.