fix: correct the error message for snappy compress (#2956)

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
This commit is contained in:
Zhenchi
2023-12-19 14:14:40 +08:00
committed by GitHub
parent 29fc2ea9d8
commit ccbd49777d
2 changed files with 9 additions and 1 deletions

View File

@@ -214,6 +214,13 @@ pub enum Error {
error: snap::Error,
},
#[snafu(display("Failed to compress prometheus remote request"))]
CompressPromRemoteRequest {
location: Location,
#[snafu(source)]
error: snap::Error,
},
#[snafu(display("Invalid prometheus remote request, msg: {}", msg))]
InvalidPromRemoteRequest { msg: String, location: Location },
@@ -444,6 +451,7 @@ impl ErrorExt for Error {
| InvalidOpentsdbJsonRequest { .. }
| DecodePromRemoteRequest { .. }
| DecodeOtlpRequest { .. }
| CompressPromRemoteRequest { .. }
| DecompressPromRemoteRequest { .. }
| InvalidPromRemoteRequest { .. }
| InvalidFlightTicket { .. }

View File

@@ -370,7 +370,7 @@ pub fn snappy_compress(buf: &[u8]) -> Result<Vec<u8>> {
let mut encoder = Encoder::new();
encoder
.compress_vec(buf)
.context(error::DecompressPromRemoteRequestSnafu)
.context(error::CompressPromRemoteRequestSnafu)
}
/// Mock timeseries for test, it is both used in servers and frontend crate