sqlite: LookupVolume: wrap error

Wrap the error with the message expexted by the system tests.

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2023-02-28 09:55:11 +01:00
parent 69ff04f736
commit 01359457c4

View File

@ -1477,7 +1477,7 @@ func (s *SQLiteState) AddPod(pod *Pod) (defErr error) {
row := tx.QueryRow("SELECT 1 FROM PodConfig WHERE Name=?;", pod.Name()) row := tx.QueryRow("SELECT 1 FROM PodConfig WHERE Name=?;", pod.Name())
if err := row.Scan(&check); err != nil { if err := row.Scan(&check); err != nil {
if !errors.Is(err, sql.ErrNoRows) { if !errors.Is(err, sql.ErrNoRows) {
return fmt.Errorf("checking if pod name %s exists in database: %w", pod.ID(), err) return fmt.Errorf("checking if pod name %s exists in database: %w", pod.Name(), err)
} }
} else if check != 0 { } else if check != 0 {
return fmt.Errorf("name \"%s\" is in use: %w", pod.Name(), define.ErrPodExists) return fmt.Errorf("name \"%s\" is in use: %w", pod.Name(), define.ErrPodExists)
@ -2064,7 +2064,7 @@ func (s *SQLiteState) LookupVolume(name string) (*Volume, error) {
foundResult = true foundResult = true
} }
if !foundResult { if !foundResult {
return nil, define.ErrNoSuchVolume return nil, fmt.Errorf("no volume with name %q found: %w", name, define.ErrNoSuchVolume)
} }
vol := new(Volume) vol := new(Volume)