This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Description
enum MyError: AbortError {
case missingUsername(metadata: Node?)
case missingEmail(metadata: Node?)
var code: Int {
switch self {
case .missingUsername: return 401
case .missingEmail: return 402
}
}
var status: Status {
return .badRequest
}
var message: String {
switch self {
case .missingUsername: return "Missing username"
case .missingEmail: return "Missing email"
}
}
var metadata: Node? {
switch self {
case missingUsername(metadata: let node): return node
case missingEmail(metadata: let node): return node
}
}
}