aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/command')
-rw-r--r--crates/shirabe/src/command/create_project_command.rs3
-rw-r--r--crates/shirabe/src/command/self_update_command.rs9
2 files changed, 7 insertions, 5 deletions
diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs
index f8fc511..c49d2fc 100644
--- a/crates/shirabe/src/command/create_project_command.rs
+++ b/crates/shirabe/src/command/create_project_command.rs
@@ -472,8 +472,7 @@ impl CreateProjectCommand {
}
}
Err(e) => {
- // TODO(phase-b): catch only PluginBlockedException
- if let Some(_pbe) = e.downcast_ref::<PluginBlockedException>() {
+ if e.downcast_ref::<PluginBlockedException>().is_some() {
io.write_error("<error>Hint: To allow running the config command recommended below before dependencies are installed, run create-project with --no-install.</error>");
io.write_error(&format!(
"<error>You can then cd into {}, configure allow-plugins, and finally run a composer install to complete the process.</error>",
diff --git a/crates/shirabe/src/command/self_update_command.rs b/crates/shirabe/src/command/self_update_command.rs
index edc2db8..5948d34 100644
--- a/crates/shirabe/src/command/self_update_command.rs
+++ b/crates/shirabe/src/command/self_update_command.rs
@@ -26,6 +26,7 @@ use crate::config::Config;
use crate::console::input::InputArgument;
use crate::console::input::InputOption;
use crate::downloader::FilesystemException;
+use crate::downloader::TransportException;
use crate::factory::Factory;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
@@ -435,15 +436,17 @@ impl SelfUpdateCommand {
) {
Ok(r) => r.get_body().map(|s| s.to_string()),
Err(e) => {
- // TODO(phase-b): TransportException::get_status_code mapping from anyhow::Error
- if false && e.to_string().contains("404") {
+ if e.downcast_ref::<TransportException>()
+ .and_then(|te| te.get_status_code())
+ == Some(404)
+ {
return Err(InvalidArgumentException {
message: format!("Version \"{}\" could not be found.", update_version),
code: 0,
}
.into());
}
- return Err(e.into());
+ return Err(e);
}
};
io.write_error3(" ", false, io_interface::NORMAL);