DockerCLI/cli
Sebastiaan van Stijn de6020a240
cli/context/store: simplify error handling, and make it more idiomatic
The package defined various special errors; these errors existed for two reasons;

- being able to distinguish "not found" errors from other errors (as "not found"
  errors can be ignored in various cases).
- to be able to update the context _name_ in the error message after the error
  was created. This was needed in cases where the name was not available at the
  location where the error was produced (e.g. only the "id" was present), and
  the helpers to detect "not found" errors did not support wrapped errors (so
  wrapping the error with a "name" could break logic); a `setContextName` interface
  and corresponding `patchErrContextName()` utility was created for this (which
  was a "creative", but not very standard approach).

This patch:

- Removes the special error-types, replacing them with errdefs definitions (which
  is a more common approach in our code-base to detect error types / classes).
- Removes the internal utilities for error-handling, and deprecates the exported
  utilities (to allow external consumers to adjust their code).
- Some errors have been enriched with detailed information (which may be useful
  for debugging / problem solving).
- Note that in some cases, `patchErrContextName()` was called, but the code
  producing the error would never return a `setContextName` error, so would
  never update the error message.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-30 11:19:25 +02:00
..
command cli/context/store: simplify error handling, and make it more idiomatic 2022-09-30 11:19:25 +02:00
compose cli/compose: remove redundant reflection from tests 2022-09-29 15:35:31 +02:00
config replace uses of deprecated env.Patch() 2022-09-22 17:28:07 +02:00
connhelper format (GoDoc) comments with Go 1.19 to prepare for go updates 2022-07-19 19:10:16 +02:00
context cli/context/store: simplify error handling, and make it more idiomatic 2022-09-30 11:19:25 +02:00
debug updated vendoring 2017-09-01 19:41:06 -04:00
flags use client consts for environment variable names 2022-03-30 17:42:20 +02:00
manifest remove unneeded "digest" alias for "go-digest" 2022-03-04 14:45:37 +01:00
registry/client cli/registry/client: remove unused IsNotFound(), and slight refactor 2022-03-30 20:00:36 +02:00
streams update docker, replace github.com/docker/pkg/term, github.com/docker/pkg/mount 2020-04-22 17:16:13 +02:00
trust linting: use consts from stdlib (usestdlibvars) 2022-09-03 21:25:32 +02:00
version Move versioning variables to a separate package. 2019-01-29 11:26:40 +00:00
winresources Use goversioninfo to create Windows Version Info 2021-10-11 16:54:22 +02:00
cobra.go cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
cobra_test.go cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
error.go Import docker/docker/cli 2017-04-17 17:40:59 -04:00
required.go format (GoDoc) comments with Go 1.19 to prepare for go updates 2022-07-19 19:10:16 +02:00
required_test.go cli: remove deprecated io/ioutil 2022-02-25 15:42:19 +01:00