From 9864c6b7f1cc1ebafae9fb632096afbe450803d5 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Mon, 2 Aug 2021 16:45:52 -0400 Subject: [PATCH] fix: Return a more helpful error message for no matching sharding rule Fixes #2127. --- src/influxdb_ioxd/rpc/error.rs | 3 ++- tests/end_to_end_cases/write_api.rs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/influxdb_ioxd/rpc/error.rs b/src/influxdb_ioxd/rpc/error.rs index a6ab258497..3bd4aeb55f 100644 --- a/src/influxdb_ioxd/rpc/error.rs +++ b/src/influxdb_ioxd/rpc/error.rs @@ -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), diff --git a/tests/end_to_end_cases/write_api.rs b/tests/end_to_end_cases/write_api.rs index ae4e5d3e7e..06a22e3a32 100644 --- a/tests/end_to_end_cases/write_api.rs +++ b/tests/end_to_end_cases/write_api.rs @@ -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" ); }