lxd/db: Don't propagate expected errors #12977
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes this error in the CI tests: https://github.com/canonical/lxd-ci/actions/runs/8062199894/job/22021469170#step:6:3297
This was recently refactored here:
https://github.com/canonical/lxd/pull/12754/files#diff-6ba9a4d3cf752f98f07e5a8ff4ba755b19eb813013b0550931532405b46ba9b9
At the end of this block, we return the
err
var. Previously this block was wrapped in a transaction which was assigned to an error, but the transaction itself would assignerr
tonil
if we received asql.ErrNoRows
error. When the transaction was removed, thereturn nil
line was removed as well, and so thesql.ErrNoRows
error was being propagated to the caller, instead ofnil
.