Skip to content

Commit

Permalink
moved the InputValidationError to the top of server.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaensen committed Mar 30, 2023
1 parent 949969b commit ec0df19
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ struct JsonRpcRequest {
params: JsonValue,
}

struct InputValidationError(String);
impl Error for InputValidationError {}

impl Debug for InputValidationError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Error: {}", self.0)
}
}
impl Display for InputValidationError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Error: {}", self.0)
}
}

pub fn start_server(listen_at: &str, queue_size: usize, threads: u64) {
let edges: Arc<RwLock<Arc<EdgeDB>>> = Arc::new(RwLock::new(Arc::new(EdgeDB::default())));

Expand Down Expand Up @@ -134,21 +148,6 @@ fn load_safes_binary(edges: &RwLock<Arc<EdgeDB>>, file: &str) -> Result<usize, B
Ok(len)
}

struct InputValidationError(String);

impl Debug for InputValidationError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Error: {}", self.0)
}
}
impl Display for InputValidationError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Error: {}", self.0)
}
}

impl Error for InputValidationError {}

fn compute_transfer(
request: JsonRpcRequest,
edges: &EdgeDB,
Expand Down

0 comments on commit ec0df19

Please sign in to comment.