desub-json-resolver 0.0.1

Decode Substrate with Backwards-Compatible Metadata
// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of substrate-desub.
//
// substrate-desub is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// substrate-desub is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with substrate-desub.  If not, see <http://www.gnu.org/licenses/>.

use thiserror::Error;

pub type Result<T> = std::result::Result<T, Error>;

#[derive(Debug, Error)]
pub enum Error {
	#[error("Decode {0}")]
	Decode(#[from] serde_json::Error),
	#[error("Could not parse {0} into type")]
	TypeError(String),
	#[error("type is not possible in the context of rust")]
	UnexpectedType,
}

impl From<String> for Error {
	fn from(err: String) -> Error {
		Error::TypeError(err)
	}
}