risingwave_frontend/scheduler/
error.rs1use risingwave_batch::error::BatchError;
16use risingwave_common::session_config::QueryMode;
17use risingwave_connector::error::ConnectorError;
18use risingwave_rpc_client::error::RpcError;
19use thiserror::Error;
20
21use crate::error::{ErrorCode, RwError};
22use crate::scheduler::plan_fragmenter::QueryId;
23
24#[derive(Error, Debug)]
25pub enum SchedulerError {
26 #[error("Pin snapshot error: {0} fails to get epoch {1}")]
27 PinSnapshot(QueryId, u64),
28
29 #[error(transparent)]
30 RpcError(
31 #[from]
32 #[backtrace]
33 RpcError,
34 ),
35
36 #[error("{0}")]
37 TaskExecutionError(String),
38
39 #[error("Task got killed because compute node running out of memory")]
40 TaskRunningOutOfMemory,
41
42 #[error("Query cancelled: {0}")]
44 QueryCancelled(String),
45
46 #[error("Reject query: the {0} query number reaches the limit: {1}")]
47 QueryReachLimit(QueryMode, u64),
48
49 #[error(transparent)]
50 BatchError(
51 #[from]
52 #[backtrace]
53 BatchError,
54 ),
55
56 #[error(transparent)]
57 Connector(
58 #[from]
59 #[backtrace]
60 ConnectorError,
61 ),
62
63 #[error(transparent)]
64 Internal(
65 #[from]
66 #[backtrace]
67 anyhow::Error,
68 ),
69}
70
71impl From<SchedulerError> for RwError {
72 fn from(s: SchedulerError) -> Self {
73 ErrorCode::SchedulerError(Box::new(s)).into()
74 }
75}
76
77impl From<RwError> for SchedulerError {
78 fn from(e: RwError) -> Self {
79 Self::Internal(e.into())
80 }
81}