arrow_udf_runtime/remote/
error.rs

1// Copyright 2024 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 arrow_flight::error::FlightError;
16use thiserror::Error;
17
18/// A specialized `Result` type for UDF operations.
19pub type Result<T, E = Error> = std::result::Result<T, E>;
20
21/// The error type for UDF operations.
22#[derive(Error, Debug)]
23pub enum Error {
24    #[error("failed to send requests to UDF service: {0}")]
25    Tonic(#[from] tonic::Status),
26
27    #[error("failed to connect to UDF service: {0}")]
28    Connect(#[from] tonic::transport::Error),
29
30    #[error("failed to call UDF: {0}")]
31    Flight(#[from] FlightError),
32
33    #[error("arrow error: {0}")]
34    Arrow(#[from] arrow_schema::ArrowError),
35
36    #[error("invalid message from UDF service: {0}")]
37    Decode(String),
38
39    #[error("Flight service error: {0}")]
40    Service(String),
41}