Skip to main content

nautilus_lighter/websocket/
error.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
3//  https://nautechsystems.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
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// -------------------------------------------------------------------------------------------------
15
16//! WebSocket error taxonomy.
17
18use nautilus_network::error::SendError;
19use thiserror::Error;
20
21/// Errors emitted by the Lighter WebSocket client.
22#[derive(Debug, Error)]
23pub enum LighterWsError {
24    /// Underlying transport failure.
25    #[error("network error: {0}")]
26    Network(String),
27    /// Send-side transport failure. Carries the structured [`SendError`]
28    /// so retry classifiers can match on the variant rather than the formatted message.
29    #[error("transport error: {0}")]
30    Transport(#[from] SendError),
31    /// Authentication failure.
32    #[error("authentication error: {0}")]
33    Authentication(String),
34    /// Failed to parse a wire frame.
35    #[error("parse error: {0}")]
36    Parse(String),
37    /// Generic client error.
38    #[error("client error: {0}")]
39    Client(String),
40}