-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Deserializing SentryNSError (#4743)
- Loading branch information
1 parent
4df6ad9
commit b6a8fd1
Showing
3 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@_implementationOnly import _SentryPrivate | ||
import Foundation | ||
|
||
extension SentryNSError: Decodable { | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case domain | ||
case code | ||
} | ||
|
||
required convenience public init(from decoder: any Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
|
||
let domain = try container.decode(String.self, forKey: .domain) | ||
let code = try container.decode(Int.self, forKey: .code) | ||
|
||
self.init(domain: domain, code: code) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters