Move RestError declaration to common. (#7)

This commit is contained in:
Eugene Kabanov 2021-05-15 02:39:22 +03:00 committed by GitHub
parent db39cdcdc7
commit 37b25eaf2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 16 deletions

View File

@ -42,19 +42,6 @@ type
RestReturnKind {.pure.} = enum
Status, PlainResponse, GenericResponse, Value
RestDefect* = object of Defect
RestError* = object of CatchableError
RestEncodingError* = object of RestError
field*: cstring
RestDecodingError* = object of RestError
RestCommunicationError* = object of RestError
exc*: ref HttpError
RestRedirectionError* = object of RestError
RestResponseError* = object of RestError
status*: int
contentType*: string
message*: string
const
RestContentTypeArg = "restContentType"
RestAcceptTypeArg = "restAcceptType"

View File

@ -42,6 +42,20 @@ type
ByteChar* = string | seq[byte]
RestDefect* = object of Defect
RestError* = object of CatchableError
RestBadRequestError* = object of RestError
RestEncodingError* = object of RestError
field*: cstring
RestDecodingError* = object of RestError
RestCommunicationError* = object of RestError
exc*: ref HttpError
RestRedirectionError* = object of RestError
RestResponseError* = object of RestError
status*: int
contentType*: string
message*: string
proc error*(t: typedesc[RestApiResponse],
status: HttpCode = Http200, msg: string = "",
contentType: string = "text/html"): RestApiResponse =

View File

@ -32,6 +32,3 @@ chronicles.expandIt(RestApiError):
type
RestServerState* {.pure.} = enum
Closed, Stopped, Running
RestError* = object of CatchableError
RestBadRequestError* = object of RestError