gadk_session/error.rs
1// Copyright 2026 Chris Olson
2// Portions derived from ADK-Go (https://github.com/google/adk-go), Copyright 2026 Google LLC.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Session errors: a missing session and a missing state key.
17
18/// Errors returned by [`crate::SessionService`], [`crate::Session`] and [`crate::State`].
19#[derive(Debug, thiserror::Error)]
20#[non_exhaustive]
21pub enum SessionError {
22 /// The requested session does not exist.
23 #[error("session not found")]
24 NotFound,
25 /// The state key does not exist.
26 #[error("state key does not exist")]
27 StateKeyNotExist,
28 /// The request failed validation.
29 #[error("invalid request: {0}")]
30 InvalidRequest(String),
31 /// A storage backend failure.
32 #[error(transparent)]
33 Backend(Box<dyn std::error::Error + Send + Sync>),
34}