aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/error_handler.h2
-rw-r--r--lib/error_handler.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/include/error_handler.h b/include/error_handler.h
index eaf6420..5e1639b 100644
--- a/include/error_handler.h
+++ b/include/error_handler.h
@@ -18,6 +18,7 @@
#define SPM_ERR_MANIFEST_EMPTY _SPM_ERR(8) // manifest file has no data
#define SPM_ERR_PARSE _SPM_ERR(9) // general parsing error
#define SPM_ERR_NOT_IMPLEMENTED _SPM_ERR(10) // not implemented (does exist on this platform)
+#define SPM_ERR_FETCH _SPM_ERR(11) // failed to download data (non-package)
extern int spmerrno;
extern const char *SPM_ERR_STRING[];
@@ -25,5 +26,6 @@ extern const char *SPM_ERR_STRING[];
void spmerrno_cause(const char *reason);
char *spm_strerror(int code);
void spm_perror(const char *msg);
+void spm_die(void);
#endif //SPM_ERROR_HANDLER_H
diff --git a/lib/error_handler.c b/lib/error_handler.c
index 2ccb4e7..5130f3a 100644
--- a/lib/error_handler.c
+++ b/lib/error_handler.c
@@ -15,6 +15,7 @@ const char *SPM_ERR_STRING[] = {
"Manifest has no data",
"Parsing error",
"Not implemented",
+ "Failed to fetch data",
NULL,
};
@@ -55,3 +56,7 @@ void spm_perror(const char *msg) {
fprintf(stderr, "%s: %s\n", msg ? msg : "", spm_strerror(spmerrno));
}
+void spm_die(void) {
+ spm_perror("FATAL");
+ exit(1);
+}