diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-04-19 16:31:45 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-04-19 16:31:45 -0400 |
commit | 6d04ff98c4bfc21ad3fa779237a16ba760080fac (patch) | |
tree | e5cdaf218d7fc563899eb44292225fca7f051363 /lib/error_handler.c | |
parent | 57c9489b28a481abc078ad3a2dd197079f9c414b (diff) | |
download | spmc-6d04ff98c4bfc21ad3fa779237a16ba760080fac.tar.gz |
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()
Diffstat (limited to 'lib/error_handler.c')
-rw-r--r-- | lib/error_handler.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/error_handler.c b/lib/error_handler.c index baf56b4..292fa6f 100644 --- a/lib/error_handler.c +++ b/lib/error_handler.c @@ -2,7 +2,13 @@ int spmerrno = 0; static char spmerrbuf[255]; +static char spmerrbuf_reason[255]; +void spmerrno_cause(const char *reason) { + char *buf = spmerrbuf_reason; + sprintf(buf, " (%s)", reason); + return; +} /** * * @param code @@ -18,6 +24,10 @@ char *spm_strerror(int code) { } else { strcpy(buf, SPM_ERR_STRING[SPM_ERR_INDEX(code)]); } + + if (strlen(spmerrbuf_reason)) { + strcat(buf, spmerrbuf_reason); + } return buf; } |