Skip to main content

ryft_core/
errors.rs

1// TODO(eaplatanios): Do we even need to take a dependency on [thiserror]?
2use thiserror::Error;
3
4// TODO(eaplatanios): Add a ryft `Result` type.
5// TODO(eaplatanios): Error messages should be concise lowercase sentences without trailing punctuation.
6// TODO(eaplatanios): Localize error types and leverage the `source` feature of [thiserror].
7
8#[derive(Error, Clone, Debug, Eq, PartialEq)]
9pub enum Error {
10    #[error("Runtime error: {message}.\n{backtrace}")]
11    RuntimeError { message: String, backtrace: String },
12
13    #[error("Got more parameters than expected.")]
14    UnusedParams,
15
16    #[error("Expected at least {expected_count} parameters but got fewer.")]
17    InsufficientParams { expected_count: usize },
18}