File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import enum AutomergeUniffi.DecodeSyncStateError
22import enum AutomergeUniffi. DocError
33import enum AutomergeUniffi. LoadError
44import enum AutomergeUniffi. ReceiveSyncError
5+ import Foundation
56
67typealias FfiDocError = AutomergeUniffi . DocError
78typealias FfiDecodeSyncStateError = AutomergeUniffi . DecodeSyncStateError
@@ -16,12 +17,27 @@ typealias FfiReceiveSyncError = AutomergeUniffi.ReceiveSyncError
1617/// An general document error.
1718///
1819/// The error is specific to the Rust language binding infrastructure.
19- public struct DocError : Error {
20+ public struct DocError : LocalizedError {
2021 let inner : FfiDocError
2122
2223 init ( _ inner: FfiDocError ) {
2324 self . inner = inner
2425 }
26+
27+ public var errorDescription : String ? {
28+ inner. errorDescription
29+ }
30+ }
31+
32+ extension FfiDocError : LocalizedError {
33+ public var errorDescription : String ? {
34+ switch self {
35+ case let . WrongObjectType( message: msg) :
36+ return " WrongObjectType: \( msg) "
37+ case let . Internal( message: msg) :
38+ return " AutomergeCore Internal Error: \( msg) "
39+ }
40+ }
2541}
2642
2743/// An error that indicates the synchronisation state could not be decoded.
You can’t perform that action at this time.
0 commit comments