summaryrefslogtreecommitdiff
path: root/cli/npm
diff options
context:
space:
mode:
Diffstat (limited to 'cli/npm')
-rw-r--r--cli/npm/cache.rs11
-rw-r--r--cli/npm/registry.rs11
2 files changed, 20 insertions, 2 deletions
diff --git a/cli/npm/cache.rs b/cli/npm/cache.rs
index 5e6fb7ca8..f3436f7c0 100644
--- a/cli/npm/cache.rs
+++ b/cli/npm/cache.rs
@@ -210,7 +210,16 @@ impl NpmCache {
if response.status() == 404 {
bail!("Could not find npm package tarball at: {}", dist.tarball);
} else if !response.status().is_success() {
- bail!("Bad response: {:?}", response.status());
+ let status = response.status();
+ let maybe_response_text = response.text().await.ok();
+ bail!(
+ "Bad response: {:?}{}",
+ status,
+ match maybe_response_text {
+ Some(text) => format!("\n\n{}", text),
+ None => String::new(),
+ }
+ );
} else {
let bytes = response.bytes().await?;
diff --git a/cli/npm/registry.rs b/cli/npm/registry.rs
index 1604f4b11..ab7d81b75 100644
--- a/cli/npm/registry.rs
+++ b/cli/npm/registry.rs
@@ -302,7 +302,16 @@ impl NpmRegistryApi {
if response.status() == 404 {
Ok(None)
} else if !response.status().is_success() {
- bail!("Bad response: {:?}", response.status());
+ let status = response.status();
+ let maybe_response_text = response.text().await.ok();
+ bail!(
+ "Bad response: {:?}{}",
+ status,
+ match maybe_response_text {
+ Some(text) => format!("\n\n{}", text),
+ None => String::new(),
+ }
+ );
} else {
let bytes = response.bytes().await?;
let package_info = serde_json::from_slice(&bytes)?;