rust-anilist 0.1.5

A Rust wrapper for the Anilist API, providing asynchronous methods to interact with various entities like Anime, Manga, User, Person, and Character.
Documentation
// SPDX-License-Identifier: MIT
// Copyright (c) 2022-2025 Andriel Ferreira <https://github.com/AndrielFR>

//! This module contains the `Error` enum.

use thiserror::Error as TError;

/// A specialized `Result` type for operations that can return an `Error`.
///
/// This is defined as a convenience to avoid writing out `std::result::Result`
/// with the `rust_anilist::Error` type repeatedly.
pub type Result<T> = std::result::Result<T, Error>;

/// Represents the various errors that can occur in the application.
///
/// This enum defines different types of errors that can be encountered,
/// such as invalid IDs and API errors.
#[derive(TError, Debug)]
pub enum Error {
    /// An error indicating that the ID is invalid.
    #[error("invalid ID")]
    InvalidId,
    /// An error indicating that the API returned an error.
    #[error("api error: `{0}`")]
    ApiError(String),
}