From ce724c18959aa183838b85d48b8c86bd7a5336a7 Mon Sep 17 00:00:00 2001 From: zian Date: Mon, 19 Jun 2023 12:08:37 +0800 Subject: [PATCH] add mandala node runner --- mandala-node-runner/src/error.rs | 20 ++++++++++++++++++++ mandala-node-runner/src/lib.rs | 4 +--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 mandala-node-runner/src/error.rs diff --git a/mandala-node-runner/src/error.rs b/mandala-node-runner/src/error.rs new file mode 100644 index 0000000..6a3dda2 --- /dev/null +++ b/mandala-node-runner/src/error.rs @@ -0,0 +1,20 @@ + +#[derive(Debug)] +pub enum Error { + Io(std::io::Error), + CouldNotExtractPort, +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Error::Io(err) => write!(f, "IO error: {err}"), + Error::CouldNotExtractPort => write!( + f, + "could not extract port from running substrate node's stdout" + ), + } + } +} + +impl std::error::Error for Error {} \ No newline at end of file diff --git a/mandala-node-runner/src/lib.rs b/mandala-node-runner/src/lib.rs index 3bfd824..f919f72 100644 --- a/mandala-node-runner/src/lib.rs +++ b/mandala-node-runner/src/lib.rs @@ -1,6 +1,4 @@ -// Copyright 2019-2023 Parity Technologies (UK) Ltd. -// This file is dual-licensed as Apache-2.0 or GPL-3.0. -// see LICENSE for license details. + mod error;