From 6d04ff98c4bfc21ad3fa779237a16ba760080fac Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 19 Apr 2020 16:31:45 -0400 Subject: Better reporting when a package does not exist * Add additional errors * Fix user_input function missing an error return value * spmbuild sources a temporary file instead of output from a sub-shell * Fix indentation problem * A reason can be attached to spmerrno using spmerrno_cause() --- include/error_handler.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/error_handler.h') diff --git a/include/error_handler.h b/include/error_handler.h index a731d28..9e7c1b8 100644 --- a/include/error_handler.h +++ b/include/error_handler.h @@ -14,6 +14,8 @@ #define SPM_ERR_PKG_INVALID _SPM_ERR(4) // invalid package (wrong structure, missing data, etc) #define SPM_ERR_PKG_CHECKSUM _SPM_ERR(5) // bad checksum #define SPM_ERR_PKG_FETCH _SPM_ERR(6) // failed to download package +#define SPM_ERR_MANIFEST_INVALID _SPM_ERR(7) // manifest file is invalid (no header) +#define SPM_ERR_MANIFEST_EMPTY _SPM_ERR(8) // manifest file has no data extern int spmerrno; @@ -25,9 +27,12 @@ static const char *SPM_ERR_STRING[] = { "Invalid package", "Bad package checksum", "Failed to fetch package", + "Manifest has no header", + "Manifest has no data", NULL, }; +void spmerrno_cause(const char *reason); char *spm_strerror(int code); void spm_perror(const char *msg); -- cgit From a5dc69b99b66b5e97ccfbb5a397c1dccf8843a82 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 19 Apr 2020 22:25:53 -0400 Subject: Properly declare SPM_ERR_STRING global --- include/error_handler.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'include/error_handler.h') diff --git a/include/error_handler.h b/include/error_handler.h index 9e7c1b8..92705fe 100644 --- a/include/error_handler.h +++ b/include/error_handler.h @@ -18,19 +18,7 @@ #define SPM_ERR_MANIFEST_EMPTY _SPM_ERR(8) // manifest file has no data extern int spmerrno; - -static const char *SPM_ERR_STRING[] = { - "Success", - "No root record", - "Dangerous root path", - "Package not found", - "Invalid package", - "Bad package checksum", - "Failed to fetch package", - "Manifest has no header", - "Manifest has no data", - NULL, -}; +extern const char *SPM_ERR_STRING[]; void spmerrno_cause(const char *reason); char *spm_strerror(int code); -- cgit