added statusCodeOffset

This commit is contained in:
Mikhail Katychev 2020-05-14 19:15:54 -05:00
parent 30ad14c3cb
commit ce24de922f
No known key found for this signature in database
GPG Key ID: 9E8549CD2CEB5E59
1 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,11 @@ import (
_ "google.golang.org/grpc/encoding/gzip"
)
// To avoid confusion between program error codes and the gRPC resonse
// status codes 'Cancelled' and 'Unknown', 1 and 2 respectively,
// the response status codes emitted use an offest of 64
const statusCodeOffset = 64
var version = "dev build <no version set>"
var (
@ -668,7 +673,7 @@ func main() {
} else {
grpcurl.PrintStatus(os.Stderr, h.Status, formatter)
}
exit(1)
exit(statusCodeOffset + int(h.Status.Code()))
}
}
}