aboutsummaryrefslogtreecommitdiffstats
path: root/src/io/connecterror.nim
blob: d2af5762ef2c3bf110b75947539e842f607368b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import bindings/curl

type ConnectErrorCode* = enum
  ERROR_INVALID_DATA_URL = (-7, "invalid data URL")
  ERROR_ABOUT_PAGE_NOT_FOUND = (-6, "about page not found")
  ERROR_FILE_NOT_FOUND = (-5, "file not found")
  ERROR_SOURCE_NOT_FOUND = (-4, "clone source could not be found"),
  ERROR_LOADER_KILLED = (-3, "loader killed during transfer"),
  ERROR_DISALLOWED_URL = (-2, "url not allowed by filter"),
  ERROR_UNKNOWN_SCHEME = (-1, "unknown scheme")

converter toInt*(code: ConnectErrorCode): int =
  return int(code)

func getLoaderErrorMessage*(code: int): string =
  if code < 0:
    return $ConnectErrorCode(code)
  return $curl_easy_strerror(CURLcode(cint(code)))