AppLoad API Error Types (api/error.rs)

hoppscotch · packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/api/error.rs · rust · MIT
dev-tools, lang:rust, fw:tauri, tag:error-handling, tag:thiserror

Defines a Rust error enum for the Tauri AppLoad plugin covering HTTP, parsing, and bundle verification failures with helper methods like is_not_found. Reuse when building Tauri plugin API clients needing structured error handling.

// Source: https://github.com/hoppscotch/hoppscotch | License: MIT | Copyright 2022
// Provided via justclaw.it.com; keep this notice with the code.
use thiserror::Error;

#[derive(Debug, Error)]
pub enum ApiError {
    #[error("HTTP request failed: {0}")]
    RequestFailed(#[from] reqwest::Error),

    #[error("Invalid server response: {0}")]
    InvalidResponse(String),

    #[error("Bundle not found: {0}")]
    BundleNotFound(String),

    #[error("File not found: {0}")]
    FileNotFound(String),

    #[error("Bundle verification failed: {0}")]
    VerificationFailed(String),

    #[error("API error {status}: {message}")]
    ServerError { status: u16, message: String },

    #[error("Failed to parse response: {0}")]
    ParseError(#[from] serde_json::Error),

    #[error("Server connec

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key