From ec0df1959ec2e7c3ec185a88009dd0b37e63f62b Mon Sep 17 00:00:00 2001 From: jaensen <4954577+jaensen@users.noreply.github.com> Date: Thu, 30 Mar 2023 04:30:34 +0200 Subject: [PATCH] moved the InputValidationError to the top of server.rs --- src/server.rs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/server.rs b/src/server.rs index 304f8bc..1cc68ec 100644 --- a/src/server.rs +++ b/src/server.rs @@ -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>> = Arc::new(RwLock::new(Arc::new(EdgeDB::default()))); @@ -134,21 +148,6 @@ fn load_safes_binary(edges: &RwLock>, file: &str) -> Result) -> 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,