fullstorydev / fullstorydev/grpcurl
need documentation about return code and how it may map to gRPC error code
- Dominant language
- Go
- Stars
- 12.8k
- Forks
- 580
- Avg merge
- 1h 8m
- Merged PRs (30d)
- 5
Description
I check the UNIX return code ($?) after executing grpcurl. It returns 0 for Success, as expected. Non-zero return codes, however, are garbled by what appears to be an extraneous bit.
For example, NOT FOUND is 5, but grpcurl returns 69.
For INVALID_ARGUMENT (3), but grpcurl returns 67.
There is an extraneous bit in position 6 (lower-order bits are in position 0-3 and you find what I believe is the true code there)
0100 0101 = 0x45 but should be 5
You made need to use the GoLang "status" package https://pkg.go.dev/google.golang.org/grpc/status
`~ > grpcurl -d '{ "source_system" : "UNKNOWN" }' -plaintext localhost:9090 tenant.TenantService.GetByEntitlementTenantId
ERROR:
Code: InvalidArgument
Message:
~ > echo $?
67
`
Note that **Success** maps to 0 properly, as shown below:
`~ > grpcurl -d '{ "tenant_id" : "5c7e1395-d2ab-4d91-b9f8-40d783cf6e12" }' -plaintext localhost:9090 tenant.TenantService.Get
{
"tenant_id": "5c7e1395-d2ab-4d91-b9f8-40d783cf6e12",
"tenant_name": "Full Story",
"created_time": "2021-02-24T00:46:33.533Z",
"updated_time": "2021-02-24T00:46:33.533Z",
"created_by": "Jason"
}
~ > echo $?
0
`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.