-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate "Not Synced" Error Messages #3418
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,7 +214,9 @@ getLedgerRange( | |
if (!bValidated) | ||
{ | ||
// Don't have a validated ledger range. | ||
return rpcLGR_IDXS_INVALID; | ||
if (context.apiVersion == 1) | ||
return rpcLGR_IDXS_INVALID; | ||
return rpcNOT_SYNCED; | ||
} | ||
|
||
std::uint32_t uLedgerMin = uValidatedMin; | ||
|
@@ -236,7 +238,11 @@ getLedgerRange( | |
uLedgerMax = ls.max; | ||
} | ||
if (uLedgerMax < uLedgerMin) | ||
return rpcLGR_IDXS_INVALID; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless I am mistaken, if the user passes invalid ledger indices, where the min is greater than the max, the error returned will be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, let's not return
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've changed this to |
||
{ | ||
if (context.apiVersion == 1) | ||
return rpcLGR_IDXS_INVALID; | ||
return rpcINVALID_LGR_RANGE; | ||
} | ||
} | ||
else | ||
{ | ||
|
@@ -330,6 +336,10 @@ populateProtoResponse( | |
{ | ||
status = {grpc::StatusCode::NOT_FOUND, error.message()}; | ||
} | ||
else if (error.toErrorCode() == rpcNOT_SYNCED) | ||
{ | ||
status = {grpc::StatusCode::FAILED_PRECONDITION, error.message()}; | ||
} | ||
else | ||
{ | ||
status = {grpc::StatusCode::INVALID_ARGUMENT, error.message()}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed this the first time around. The gRPC methods need to be changed to handle this new error.
rpcNOT_SYNCED
should beFAILED_PRECONDITION
andrpcINVALID_LEDGER_RANGE
should beINVALID_ARGUMENT
. The errors are parsed inpopulateProtoResponse()
. More details about the gRPC error codes can be found here: https://grpc.github.io/grpc/core/md_doc_statuscodes.htmlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've changed the approach of this PR, but I've not yet checked it in (hopefully later today). Behavior for gRPC is not going to change at all. More details later...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make the same changes to gRPC as we did for the JSON API. We can forget about versioning for gRPC, but gRPC needs to handle this new error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a commit that has the changes I am requesting: cjcobb23@022605f