<commit_before>//! ReQL Error Messages
//!
//! These are the error messages returned by the driver. See their [documentation] for details.
//!
//! [documentation]: https://www.rethinkdb.com/docs/error-types/

/// The most generic error message in ReQL
#[derive(Debug)]
pub enum ReqlError {
    Compile(ReqlCompileError),
    Runtime(ReqlRuntimeError),
    Driver(ReqlDriverError),
}

/// The query cannot be compiled by the server
///
/// This may be due to a syntax error, such as an unrecognized optional argument, or specifying the
/// wrong number of arguments to a command.
#[derive(Debug)]
pub enum ReqlCompileError {}

/// The parent class of all runtime errors
///
/// All errors on the server unrelated to compilation. Programs may use this to catch any runtime
/// error, but the server will always return a more specific error class.
#[derive(Debug)]
pub enum ReqlRuntimeError {
    QueryLogic(ReqlQueryLogicError),
    ResourceLimit(ReqlResourceLimitError),
    User(ReqlUserError),
    Internal(ReqlInternalError),
    Timeout(ReqlTimeoutError),
    Availability(ReqlAvailabilityError),
    Permissions(ReqlPermissionsError),
}

/// The query contains a logical impossibility, such as adding a number to a string.
#[derive(Debug)]
pub enum ReqlQueryLogicError {<commit_msg>Implement From for ReqlError<commit_after>//! ReQL Error Messages
//!
//! These are the error messages returned by the driver. See their [documentation] for details.
//!
//! [documentation]: https://www.rethinkdb.com/docs/error-types/

/// The most generic error message in ReQL
#[derive(Debug)]
pub enum ReqlError {
    Compile(ReqlCompileError),
    Runtime(ReqlRuntimeError),
    Driver(ReqlDriverError),
}

impl From<ReqlCompileError> for ReqlError {
    fn from(err: ReqlCompileError) -> ReqlError {
        ReqlError::Compile(err)
    }
}

impl From<ReqlRuntimeError> for ReqlError {
    fn from(err: ReqlRuntimeError) -> ReqlError {
        ReqlError::Runtime(err)
    }
}

impl From<ReqlDriverError> for ReqlError {
    fn from(err: ReqlDriverError) -> ReqlError {
        ReqlError::Driver(err)
    }
}

/// The query cannot be compiled by the server
///
/// This may be due to a syntax error, such as an unrecognized optional argument, or specifying the
/// wrong number of arguments to a command.
#[derive(Debug)]
pub enum ReqlCompileError {}

/// The parent class of all runtime errors
///
/// All errors on the server unrelated to compilation. Programs may use this to catch any runtime
/// error, but the server will always return a more specific error class.
#[derive(Debug)]
pub enum ReqlRuntimeError {
    QueryLogic(ReqlQueryLogicError),
    ResourceLimit(ReqlResourceLimitError),
    User(ReqlUserError),
    Internal(ReqlInternalError),
    Timeout(ReqlTimeoutError),
    Availability(ReqlAvailabilityError),
    Permissions(ReqlPermissionsError),
}

/// The query contains a logical impossibility, such as adding a number to a string.
#[derive(Debug)]
pub enum ReqlQueryLogicError {
{'fraction_non_alphanumeric': 0.1013716962194714, 'fraction_numerical': 0.0, 'mean_word_length': 3.9667774086378738, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5776711', 'n_tokens_mistral': 866, 'n_tokens_neox': 845, 'n_words': 300}