moby/layer
Sebastiaan van Stijn 22f303e422
layer: NewStoreFromOptions(): include driver-name in error message
When reading through some bug reports, I noticed that the error-message for
unsupported storage drivers is not very informative, as it does not include
the actual storage driver. Some of these errors are used as sentinel errors
internally, so improving the error returned by graphdriver.New() may need
some additional work, but this patch makes a start by including the name
of the graphdriver (if set) in the error-message.

Before this patch:

    dockerd --storage-driver=foobar
    ...
    failed to start daemon: error initializing graphdriver: driver not supported

With this patch:

    dockerd --storage-driver=foobar
    ...
    failed to start daemon: error initializing graphdriver: driver not supported: foobar

It's worth noting that there may be code "in the wild" that perform string-
matching on this error (e.g. [balena][1]), which is why I included the name as a separate "component"
in the output, to allow matching parts of the error.

[1]: 3d5c77a466/lib/preload.ts (L34-L35)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-06 13:06:16 +01:00
..
empty.go layer: remove unused error return from .Size() and .DiffSize() 2022-01-24 18:45:47 +01:00
empty_test.go remove unneeded "digest" alias for "go-digest" 2022-03-04 14:49:42 +01:00
filestore.go Remove uses of deprecated go-digest.NewDigestFromHex, go-digest.Digest.Hex 2022-11-08 16:42:13 +01:00
filestore_test.go layer: gofumpt 2022-10-08 19:15:28 +02:00
layer.go pkg/containerfs: drop ContainerFS type alias 2022-09-23 16:56:53 -04:00
layer_store.go layer: NewStoreFromOptions(): include driver-name in error message 2023-03-06 13:06:16 +01:00
layer_store_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
layer_test.go use errors.Is() to handle image store errors 2023-01-02 09:41:50 +01:00
layer_unix.go Update to Go 1.17.0, and gofmt with Go 1.17 2021-08-24 23:33:27 +02:00
layer_unix_test.go layer: gofumpt 2022-10-08 19:15:28 +02:00
layer_windows.go pkg/containerfs: alias ContainerFS to string 2022-09-23 16:56:52 -04:00
migration.go Merge pull request #43302 from thaJeztah/layer_remove_getwithoutlock 2022-03-05 21:18:26 +01:00
migration_test.go layer: gofumpt 2022-10-08 19:15:28 +02:00
mount_test.go layer: gofumpt 2022-10-08 19:15:28 +02:00
mounted_layer.go pkg/containerfs: drop ContainerFS type alias 2022-09-23 16:56:53 -04:00
ro_layer.go layer: gofumpt 2022-10-08 19:15:28 +02:00
ro_layer_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00