Commit Graph

10 Commits

Author SHA1 Message Date
Michael Crosby
61d930ad5b Move specific errors to their respective packages
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-15 20:21:11 +00:00
Fahed Dorgaa
70b00a0fa9 fix variable name
Signed-off-by: Fahed Dorgaa <fahed.dorgaa@gmail.com>
2019-07-14 21:47:15 +02:00
Fahed Dorgaa
db95af43f3 centralize harded-code message
Signed-off-by: Fahed Dorgaa <fahed.dorgaa@gmail.com>
2019-07-13 15:07:23 +02:00
Justin Terry (VM)
ac4485c76a Add support to gRPC errdefs for context cancel/deadline exceeded
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-05-28 17:02:29 -07:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Michael Crosby
f43b7acfd2 Update files based on go lint
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-02 10:15:28 -04:00
Stephen J Day
94f6be5f10
platforms: implement matcher support
Matching support is now implemented in the platforms package. The
`Parse` function now returns a matcher object that can be used to
match OCI platform specifications. We define this as an interface to
allow the creation of helpers oriented around platform selection.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-08 19:22:29 -07:00
Derek McGowan
2fa366d6af
Add support for multiple differs
Updates the differ service to support calling and configuring
multiple differs. The differs are configured as an ordered list
of differs which will each be attempting until a supported differ
is called.

Additionally a not supported error type was added to allow differs
to be selective of whether the differ arguments are supported by
the differ. This error type corresponds to the GRPC unimplemented error.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-18 11:19:08 -07:00
Kenfe-Mickael Laventure
546f045128
Update errdefs.ErrInvalidArgument message
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-21 18:19:51 +02:00
Stephen J Day
a4fadc596b
errdefs: centralize error handling
Now that we have most of the services required for use with containerd,
it was found that common patterns were used throughout services. By
defining a central `errdefs` package, we ensure that services will map
errors to and from grpc consistently and cleanly. One can decorate an
error with as much context as necessary, using `pkg/errors` and still
have the error mapped correctly via grpc.

We make a few sacrifices. At this point, the common errors we use across
the repository all map directly to grpc error codes. While this seems
positively crazy, it actually works out quite well. The error conditions
that were specific weren't super necessary and the ones that were
necessary now simply have better context information. We lose the
ability to add new codes, but this constraint may not be a bad thing.

Effectively, as long as one uses the errors defined in `errdefs`, the
error class will be mapped correctly across the grpc boundary and
everything will be good. If you don't use those definitions, the error
maps to "unknown" and the error message is preserved.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-29 15:00:47 -07:00