-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aditya Mukhopadhyay
committed
Jul 7, 2023
1 parent
f31fb2d
commit 3dada33
Showing
3 changed files
with
27 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
pub const ERROR_INVALID_SCHEMA_FILE: i32 = 1; | ||
pub const ERROR_INVALID_SCHEMA: i32 = 2; | ||
pub const ERROR_BAD_QUERY: i32 = 3; | ||
use std::fmt::Display; | ||
|
||
pub enum ErrorCode { | ||
InvalidSchemaFile = 1, | ||
InvalidSchema = 2, | ||
BadQuery = 3, | ||
} | ||
|
||
impl Display for ErrorCode { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
let error_code = match self { | ||
ErrorCode::InvalidSchemaFile => "InvalidSchemaFile", | ||
ErrorCode::InvalidSchema => "InvalidSchema", | ||
ErrorCode::BadQuery => "BadQuery", | ||
}; | ||
write!(f, "{}", error_code) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters