1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 17:14:08 +02:00

better pull errors

This commit is contained in:
Robin Appelman 2022-01-24 17:11:47 +01:00
commit 0869c89eec
2 changed files with 7 additions and 3 deletions

View file

@ -175,7 +175,9 @@ impl Database {
if matches!(self, Database::Sqlite) {
return Ok(None);
}
pull_image(docker, self.image()).await?;
pull_image(docker, self.image())
.await
.wrap_err("Failed to pull database image")?;
let options = Some(CreateContainerOptions {
name: format!("{}-db", cloud_id),
});

View file

@ -2,7 +2,7 @@ use bollard::image::CreateImageOptions;
use bollard::models::CreateImageInfo;
use bollard::Docker;
use futures_util::StreamExt;
use miette::{IntoDiagnostic, Result};
use miette::{IntoDiagnostic, Result, WrapErr};
use std::collections::HashMap;
use std::io::stdout;
use std::io::Write;
@ -29,7 +29,9 @@ pub async fn pull_image(docker: &Docker, image: &str) -> Result<()> {
let mut stdout = stdout();
while let Some(info) = info_stream.next().await {
let info: CreateImageInfo = info.into_diagnostic()?;
let info: CreateImageInfo = info
.into_diagnostic()
.wrap_err_with(|| format!("Error while pulling image {}", image))?;
// dbg!(&info);
if let (Some(id), Some(status), Some(progress)) = (info.id, info.status, info.progress)
{