Errors - Result subtype using SloxError
This commit is contained in:
parent
d3398e5f79
commit
a59dc21223
1 changed files with 3 additions and 0 deletions
|
@ -33,6 +33,9 @@ pub struct SloxError {
|
||||||
message: String,
|
message: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return type for SLox functions.
|
||||||
|
pub type SloxResult<T> = Result<T, SloxError>;
|
||||||
|
|
||||||
impl SloxError {
|
impl SloxError {
|
||||||
/// Initialize a record for a scanner error.
|
/// Initialize a record for a scanner error.
|
||||||
pub fn scanner_error(line: usize, ch: Option<char>, message: String) -> Self {
|
pub fn scanner_error(line: usize, ch: Option<char>, message: String) -> Self {
|
||||||
|
|
Loading…
Reference in a new issue