risingwave_common/util/value_encoding/
error.rs

1// Copyright 2025 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use thiserror::Error;
16
17#[derive(Error, Debug)]
18pub enum ValueEncodingError {
19    #[error("Invalid bool value encoding: {0}")]
20    InvalidBoolEncoding(u8),
21    #[error("Invalid UTF8 value encoding: {0}")]
22    InvalidUtf8(#[from] std::string::FromUtf8Error),
23    #[error("Invalid Date value encoding: days: {0}")]
24    InvalidDateEncoding(i32),
25    #[error("invalid Timestamp value encoding: secs: {0} nsecs: {1}")]
26    InvalidTimestampEncoding(i64, u32),
27    #[error("invalid Time value encoding: secs: {0} nano: {1}")]
28    InvalidTimeEncoding(u32, u32),
29    #[error("Invalid null tag value encoding: {0}")]
30    InvalidTagEncoding(u8),
31    #[error("Invalid jsonb encoding")]
32    InvalidJsonbEncoding,
33    #[error("Invalid struct encoding: {0}")]
34    InvalidStructEncoding(
35        #[source]
36        #[backtrace]
37        crate::array::ArrayError,
38    ),
39    #[error("Invalid list encoding: {0}")]
40    InvalidListEncoding(
41        #[source]
42        #[backtrace]
43        crate::array::ArrayError,
44    ),
45    #[error("Invalid flag: {0:b}")]
46    InvalidFlag(u8),
47}