Skip to content

Commit

Permalink
Move RestError declaration to common. (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheatfate committed May 14, 2021
1 parent db39cdc commit 37b25ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
13 changes: 0 additions & 13 deletions presto/client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions presto/common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
3 changes: 0 additions & 3 deletions presto/servercommon.nim
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,3 @@ chronicles.expandIt(RestApiError):
type
RestServerState* {.pure.} = enum
Closed, Stopped, Running

RestError* = object of CatchableError
RestBadRequestError* = object of RestError

0 comments on commit 37b25ea

Please sign in to comment.