def classify_open
mylsm-lsm-store@0.6.0.1 · src/DurableError.bend:48
import mylsm-lsm-store@0.6.0.1/src/DurableError.bend as DurableError
import Base
48
49def classify_open(cause: OpenCause, operation: String, path: String) -> Error:
50 match cause:
51 case MissingPath{}:
52 error(NotFound{}, operation, path, 0, "")
53 case ExistingPath{}:
54 error(AlreadyExists{}, operation, path, 0, "")
55 case Locked{}:
56 error(Busy{}, operation, path, 0, "")
57 case InvalidInput{}:
58 error(InvalidArgument{}, operation, path, 0, "")
59 case UnknownFormat{}:
60 error(UnsupportedFormat{}, operation, path, 0, "")
61 case CorruptData{}:
62 error(Corruption{}, operation, path, 0, "")
63 case LimitReached{}:
64 error(ResourceLimit{}, operation, path, 0, "")
65 case OpenHostFailure{code, message}:
66 error(Io{}, operation, path, code, message)