Skip to content

Commit

Permalink
Improved error codes (#719)
Browse files Browse the repository at this point in the history
# Description
Trivial improvement of error codes.

## Type of change
- [x] Bug fix & code cleanup
- [ ] New feature
- [ ] Documentation update
- [ ] Test update

## Checklist for the reviewer
This checklist should be used as a help for the reviewer.

- [ ] Is the change limited to one issue?
- [ ] Does this PR close the issue?
- [ ] Is the code easy to read and understand?
- [ ] Do all new feature have an accompanying new test?
- [ ] Has the documentation been updated as necessary?
  • Loading branch information
jesper-friis authored Dec 2, 2023
2 parents dea0dee + b67b024 commit 2c8ae1c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/dlite-storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ void dlite_storage_set_idflag(DLiteStorage *s, DLiteIDFlag idflag)
void *dlite_storage_iter_create(DLiteStorage *s, const char *pattern)
{
if (!s->api->iterCreate)
return errx(1, "driver '%s' does not support iterCreate()",
return errx(dliteUnsupportedError,
"driver '%s' does not support iterCreate()",
s->api->name), NULL;
return s->api->iterCreate(s, pattern);
}
Expand All @@ -206,7 +207,8 @@ void *dlite_storage_iter_create(DLiteStorage *s, const char *pattern)
int dlite_storage_iter_next(DLiteStorage *s, void *iter, char *buf)
{
if (!s->api->iterNext)
return errx(-1, "driver '%s' does not support iterNext()", s->api->name);
return errx(dliteUnsupportedError,
"driver '%s' does not support iterNext()", s->api->name);
return s->api->iterNext(iter, buf);
}

Expand All @@ -219,7 +221,8 @@ void dlite_storage_iter_free(DLiteStorage *s, void *iter)
if (dlite_globals_get_state(ATEXIT_MARKER_ID)) return;

if (!s->api->iterFree)
errx(1, "driver '%s' does not support iterFree()", s->api->name);
errx(dliteUnsupportedError,
"driver '%s' does not support iterFree()", s->api->name);
else
s->api->iterFree(iter);
}
Expand Down

0 comments on commit 2c8ae1c

Please sign in to comment.