Caps-Server/Sources/App/Error.swift
Christoph Hagen 658f5b186d Set port
2020-09-20 12:36:10 +02:00

32 lines
561 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 {
/// 404
case .unknownId: return .notFound
/// 400
case .invalidBody: return .badRequest
/// 409
case .dataInconsistency: return .conflict
/// 412
case .invalidFile: return .preconditionFailed
}
}
}