28 lines
497 B
Swift
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
|
|
}
|
|
}
|
|
}
|
|
|