about summary refs log tree commit diff stats
path: root/src/loader/connecterror.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-14 01:41:47 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-14 02:01:21 +0200
commitc1b8338045716b25d664c0b8dd91eac0cb76480e (patch)
treea9c0a6763f180c2b6dd380aa880253ffc7685d85 /src/loader/connecterror.nim
parentdb0798acccbedcef4b16737f6be0cf7388cc0528 (diff)
downloadchawan-c1b8338045716b25d664c0b8dd91eac0cb76480e.tar.gz
move around more modules
* ips -> io/
* loader related stuff -> loader/
* tempfile -> extern/
* buffer, forkserver -> server/
* lineedit, window -> display/
* cell -> types/
* opt -> types/
Diffstat (limited to 'src/loader/connecterror.nim')
-rw-r--r--src/loader/connecterror.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/loader/connecterror.nim b/src/loader/connecterror.nim
new file mode 100644
index 00000000..d2af5762
--- /dev/null
+++ b/src/loader/connecterror.nim
@@ -0,0 +1,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)))