mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 18:52:58 +03:00
use from error macro in leo cli
This commit is contained in:
parent
bd54f367cf
commit
e19f234d27
@ -3,133 +3,49 @@ use crate::errors::*;
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CLIError {
|
||||
#[error("{}", _0)]
|
||||
BuildError(BuildError),
|
||||
BuildError(#[from] BuildError),
|
||||
|
||||
#[error("{}: {}", _0, _1)]
|
||||
Crate(&'static str, String),
|
||||
|
||||
#[error("{}", _0)]
|
||||
ChecksumFileError(ChecksumFileError),
|
||||
ChecksumFileError(#[from] ChecksumFileError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
GitignoreError(GitignoreError),
|
||||
GitignoreError(#[from] GitignoreError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
InitError(InitError),
|
||||
InitError(#[from] InitError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
InputsDirectoryError(InputsDirectoryError),
|
||||
InputsDirectoryError(#[from] InputsDirectoryError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
MainFileError(MainFileError),
|
||||
MainFileError(#[from] MainFileError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
ManifestError(ManifestError),
|
||||
ManifestError(#[from] ManifestError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
NewError(NewError),
|
||||
NewError(#[from] NewError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
OutputsDirectoryError(OutputsDirectoryError),
|
||||
OutputsDirectoryError(#[from] OutputsDirectoryError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
ProofFileError(ProofFileError),
|
||||
ProofFileError(#[from] ProofFileError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
ProvingKeyFileError(ProvingKeyFileError),
|
||||
ProvingKeyFileError(#[from] ProvingKeyFileError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
RunError(RunError),
|
||||
RunError(#[from] RunError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
SourceDirectoryError(SourceDirectoryError),
|
||||
SourceDirectoryError(#[from] SourceDirectoryError),
|
||||
|
||||
#[error("{}", _0)]
|
||||
VerificationKeyFileError(VerificationKeyFileError),
|
||||
}
|
||||
|
||||
impl From<BuildError> for CLIError {
|
||||
fn from(error: BuildError) -> Self {
|
||||
CLIError::BuildError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ChecksumFileError> for CLIError {
|
||||
fn from(error: ChecksumFileError) -> Self {
|
||||
CLIError::ChecksumFileError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GitignoreError> for CLIError {
|
||||
fn from(error: GitignoreError) -> Self {
|
||||
CLIError::GitignoreError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<InitError> for CLIError {
|
||||
fn from(error: InitError) -> Self {
|
||||
CLIError::InitError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<InputsDirectoryError> for CLIError {
|
||||
fn from(error: InputsDirectoryError) -> Self {
|
||||
CLIError::InputsDirectoryError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<MainFileError> for CLIError {
|
||||
fn from(error: MainFileError) -> Self {
|
||||
CLIError::MainFileError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ManifestError> for CLIError {
|
||||
fn from(error: ManifestError) -> Self {
|
||||
CLIError::ManifestError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<NewError> for CLIError {
|
||||
fn from(error: NewError) -> Self {
|
||||
CLIError::NewError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<OutputsDirectoryError> for CLIError {
|
||||
fn from(error: OutputsDirectoryError) -> Self {
|
||||
CLIError::OutputsDirectoryError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ProofFileError> for CLIError {
|
||||
fn from(error: ProofFileError) -> Self {
|
||||
CLIError::ProofFileError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ProvingKeyFileError> for CLIError {
|
||||
fn from(error: ProvingKeyFileError) -> Self {
|
||||
CLIError::ProvingKeyFileError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<RunError> for CLIError {
|
||||
fn from(error: RunError) -> Self {
|
||||
CLIError::RunError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SourceDirectoryError> for CLIError {
|
||||
fn from(error: SourceDirectoryError) -> Self {
|
||||
CLIError::SourceDirectoryError(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<VerificationKeyFileError> for CLIError {
|
||||
fn from(error: VerificationKeyFileError) -> Self {
|
||||
CLIError::VerificationKeyFileError(error)
|
||||
}
|
||||
VerificationKeyFileError(#[from] VerificationKeyFileError),
|
||||
}
|
||||
|
||||
impl From<leo_compiler::errors::CompilerError> for CLIError {
|
||||
|
@ -8,11 +8,5 @@ pub enum BuildError {
|
||||
MainFileDoesNotExist(OsString),
|
||||
|
||||
#[error("{}", _0)]
|
||||
ManifestError(ManifestError),
|
||||
}
|
||||
|
||||
impl From<ManifestError> for BuildError {
|
||||
fn from(error: ManifestError) -> Self {
|
||||
BuildError::ManifestError(error)
|
||||
}
|
||||
ManifestError(#[from] ManifestError),
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ pub enum InitError {
|
||||
DirectoryDoesNotExist(OsString),
|
||||
|
||||
#[error("{}", _0)]
|
||||
ManifestError(ManifestError),
|
||||
ManifestError(#[from] ManifestError),
|
||||
|
||||
#[error("package at path {:?} already exists", _0)]
|
||||
PackageAlreadyExists(OsString),
|
||||
@ -20,9 +20,3 @@ pub enum InitError {
|
||||
#[error("package name is missing - {:?}", _0)]
|
||||
ProjectNameInvalid(OsString),
|
||||
}
|
||||
|
||||
impl From<ManifestError> for InitError {
|
||||
fn from(error: ManifestError) -> Self {
|
||||
InitError::ManifestError(error)
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ pub enum NewError {
|
||||
DirectoryAlreadyExists(OsString),
|
||||
|
||||
#[error("{}", _0)]
|
||||
ManifestError(ManifestError),
|
||||
ManifestError(#[from] ManifestError),
|
||||
|
||||
#[error("package at path {:?} already exists", _0)]
|
||||
PackageAlreadyExists(OsString),
|
||||
@ -20,9 +20,3 @@ pub enum NewError {
|
||||
#[error("package name is missing - {:?}", _0)]
|
||||
ProjectNameInvalid(OsString),
|
||||
}
|
||||
|
||||
impl From<ManifestError> for NewError {
|
||||
fn from(error: ManifestError) -> Self {
|
||||
NewError::ManifestError(error)
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,5 @@ pub enum RunError {
|
||||
MainFileDoesNotExist(OsString),
|
||||
|
||||
#[error("{}", _0)]
|
||||
ManifestError(ManifestError),
|
||||
}
|
||||
|
||||
impl From<ManifestError> for RunError {
|
||||
fn from(error: ManifestError) -> Self {
|
||||
RunError::ManifestError(error)
|
||||
}
|
||||
ManifestError(#[from] ManifestError),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user