Skip to content

Commit

Permalink
add error description
Browse files Browse the repository at this point in the history
Signed-off-by: L1MeN9Yu <baal998.mophisto@gmail.com>
  • Loading branch information
L1MeN9Yu committed Nov 22, 2019
1 parent 1ae44c4 commit 817ce29
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Elva.Mac.CoimmandLine.Demo/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
import Foundation
import Elva

Elva.setup(environment: Env.self)
Elva.register(environment: Env.self)
2 changes: 1 addition & 1 deletion Source/Frontend/Elva.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

private(set) var __environment: Environment.Type?

public func setup(environment: Environment.Type) {
public func register(environment: Environment.Type) {
__environment = environment
elva_setup { flag, file, function, line, message in
guard let logFlag = LogFlag(unsignedIntValue: CUnsignedInt(flag)),
Expand Down
13 changes: 13 additions & 0 deletions Source/Frontend/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@ public enum Error: Swift.Error {
case compress
case decompress
}

extension Error: CustomStringConvertible {
public var description: String {
switch self {
case .compress:
return "compress error"
case .decompress:
return "decompress error"
@unknown default:
return "unknown error"
}
}
}

0 comments on commit 817ce29

Please sign in to comment.