Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Should not ignore error from publish respond #48

Closed
andylokandy opened this issue Apr 9, 2019 · 1 comment
Closed

Should not ignore error from publish respond #48

andylokandy opened this issue Apr 9, 2019 · 1 comment

Comments

@andylokandy
Copy link
Member

Assume that we already have lightyear|0.2.4 on index and we try to publish it again by cli, ideally we will get 400 bad request status code and a error msg like this :

{error:"no_permission",description:"Package `lightyear/lightyear 0.2.4` already exists"}

But now elba shows success in terminal:

elba publish
       [1/2] Resolving dependencies...

       [2/2] Building targets...
    Building lightyear/lightyear 0.2.4 (dir+C:\Users\Andy\Desktop\tests\lightyear) [ef9499ab..]


  Publishing package lightyear/lightyear|0.2.4

done! published package to index index+git+https://github.com/andylokandy/index.git#master [3.88s]
@andylokandy
Copy link
Member Author

andylokandy commented Apr 9, 2019

All possible error tags are here:

#[derive(Debug)]
pub enum Reason {
    InvalidFormat,
    InvalidManifest,
    NoPermission,
    UserNotFound,
    TokenNotFound,
    PackageNotFound,
    DependencyNotFound,
}

impl Reason {
    pub fn tag(&self) -> &'static str {
        match self {
            Reason::InvalidFormat => "invalid_format",
            Reason::InvalidManifest => "invalid_manifest",
            Reason::NoPermission => "no_permission",
            Reason::UserNotFound => "user_not_found",
            Reason::TokenNotFound => "token_not_found",
            Reason::PackageNotFound => "package_not_found",
            Reason::DependencyNotFound => "dependency_not_found",
        }
    }
}

Bu now we can just show the body of respond directly.

@dcao dcao closed this as completed in 3ed3ad7 Apr 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant