Caps-Server/Sources/App/Error.swift
christophhagen 4469985959 First try
2020-05-19 15:19:19 +02:00

28 lines
497 B
Swift

//
// Error.swift
// App
//
// Created by Christoph on 17.05.20.
//
import Foundation
import Vapor
enum CapError: Error {
case unknownId
case invalidBody
case dataInconsistency
case invalidFile
var response: HTTPResponseStatus {
switch self {
case .unknownId: return .notFound
case .invalidBody: return .badRequest
case .dataInconsistency: return .conflict
case .invalidFile: return .preconditionFailed
}
}
}