Skip to content

Commit

Permalink
chore: nice errors on failed forc-index-deploy (#1408)
Browse files Browse the repository at this point in the history
* chore: nice errors on failed forc-index-deploy

* cargo fmt

* lostman feedback
  • Loading branch information
ra0x3 authored Oct 13, 2023
1 parent c638f2d commit 560fc8e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/forc-index/src/ops/forc_index_deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,16 @@ pub async fn init(command: DeployCommand) -> anyhow::Result<()> {
.headers(headers)
.send()
.await
.expect("Failed to deploy indexer.");
.unwrap_or_else(|e| {
error!("❌ Failed to deploy indexer: {e}");
std::process::exit(1);
});

let status = res.status();
let res_json = res
.json::<Map<String, Value>>()
.await
.expect("Failed to read JSON response.");
let res_json = res.json::<Map<String, Value>>().await.unwrap_or_else(|e| {
error!("❌ Failed to read indexer's response as JSON: {e}");
std::process::exit(1);
});

if status != StatusCode::OK {
if verbose {
Expand Down

0 comments on commit 560fc8e

Please sign in to comment.