refactor: Storage driver errors

Small refactoring of storagedriver errors.
We change the Enclosed field to Detail and make sure
Errors get properly serialized to JSON.
We also add tests.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
This commit is contained in:
Milos Gajdos
2023-10-18 10:02:21 +01:00
parent 915ad2d5a6
commit ea41722902
3 changed files with 111 additions and 11 deletions

View File

@@ -79,12 +79,10 @@ func (base *Base) setDriverName(e error) error {
actual.DriverName = base.StorageDriver.Name()
return actual
default:
storageError := storagedriver.Error{
return storagedriver.Error{
DriverName: base.StorageDriver.Name(),
Enclosed: e,
Detail: e,
}
return storageError
}
}