fix: Return a more helpful error message for no matching sharding rule

Fixes #2127.
pull/24376/head
Carol (Nichols || Goulding) 2021-08-02 16:45:52 -04:00
parent ac67caf7a1
commit 9864c6b7f1
2 changed files with 5 additions and 2 deletions

View File

@ -38,7 +38,8 @@ pub fn default_server_error_handler(error: server::Error) -> tonic::Status {
description: "hard buffer limit reached".to_string(),
}
.into(),
source @ Error::WritingOnlyAllowedThroughWriteBuffer { .. } => tonic::Status::failed_precondition(source.to_string()),
source @ Error::WritingOnlyAllowedThroughWriteBuffer { .. } |
source @ Error::LineConversion { .. } => tonic::Status::failed_precondition(source.to_string()),
Error::NoRemoteConfigured { node_group } => NotFound {
resource_type: "remote".to_string(),
resource_name: format!("{:?}", node_group),

View File

@ -498,7 +498,9 @@ async fn test_write_dev_null() {
assert_eq!(
err.to_string(),
"Unexpected server error: Internal error: Internal Error"
"Unexpected server error: The system is not in a state required for the operation's \
execution: error converting line protocol to flatbuffers: Error getting shard id No \
sharding rule matches line: mem bar=1 1"
);
}