-
Notifications
You must be signed in to change notification settings - Fork 20
Possibility to distinguish ErrMissingDriver
#106
Comments
It seems like a generally useful thing to have. I'm a little surprised we aren't propagating some kind of standard machine-readable codes here (whether the set from gRPC or otherwise). |
This is currently an example of missing driver, and the gRPC error code is Unknown.
|
@se7entyse7en true, here is the relevant place where this gets exposed protocol/service.go#L127 and here is how the client works this around bblfshctl/cmd/driver_install.go#L343 @creachadair do you have any insights on what's the best way to propagate these though gRPC? gRPC metadata or something else? |
For errors, I would recommend we try to use https://godoc.org/google.golang.org/grpc/status to construct error responses, and set appropriate codes. The On the client side, the client can use The exact API varies by language—what I described above uses the Go libraries—but the status mechanism is common to gRPC. |
Cool it's exactly what we are already using so far on the lower The thing is - we would still need to have error string parsing inside bblfshd, in order to get this condition as, as one can see in the second link, when this happens the only thing we get from Docker API underneath is If everyone thinks that it's a good idea to do so - I'll be happy to look a bit deeper and submit a PR exposing it later this Q. \cc @dennwc |
Unfortunately, that is sometimes the only available solution. We can write a function to do the translation to canonical codes in one place for this particular API, so that at least we have a seam for fixing regressions from upstream. The important thing from the client's perspective is that they should get reasonably standard error codes for things, and a message they could debug from. 🙂 Obviously parsing stderr is never ideal, but for messages that are generated programmatically it's usually at least possible to bound the set of possible responses. And of course we can always fall back to |
Separately: An error like |
AFAIU the only errors exposed by the client are these. Is it possible to also distinguish
ErrMissingDriver
error? In our opinion handling this error differently is common as can be seen here.The text was updated successfully, but these errors were encountered: