mirror of
https://codeberg.org/icewind/haze.git
synced 2026-10-01 08:44:09 +02:00
improve error message when setting up mappings fails
This commit is contained in:
parent
ed78642194
commit
165cf3ce93
1 changed files with 17 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use crate::config::{HazeConfig, HazeVolumeConfig};
|
||||
use camino::{Utf8Path, Utf8PathBuf};
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
use miette::{Context, IntoDiagnostic, Result};
|
||||
use std::borrow::Cow;
|
||||
use tokio::fs::{create_dir_all, write};
|
||||
|
||||
|
|
@ -97,8 +97,14 @@ impl<'a> Mapping<'a> {
|
|||
MappingSourceType::Absolute => self.source.as_ref().into(),
|
||||
};
|
||||
match self.mapping_type {
|
||||
MappingType::Folder => create_dir_all(source).await.into_diagnostic()?,
|
||||
MappingType::File => write(source, "").await.into_diagnostic()?,
|
||||
MappingType::Folder => create_dir_all(source)
|
||||
.await
|
||||
.into_diagnostic()
|
||||
.wrap_err("Failed to create source folder")?,
|
||||
MappingType::File => write(source, "")
|
||||
.await
|
||||
.into_diagnostic()
|
||||
.wrap_err("Failed to create source file")?,
|
||||
}
|
||||
|
||||
// For worktrees, pre-create mountpoints within /var/www/html to prevent docker from creating them as root.
|
||||
|
|
@ -109,8 +115,14 @@ impl<'a> Mapping<'a> {
|
|||
.unwrap_or(&self.target),
|
||||
);
|
||||
match self.mapping_type {
|
||||
MappingType::Folder => create_dir_all(local_target).await.into_diagnostic()?,
|
||||
MappingType::File => write(local_target, "").await.into_diagnostic()?,
|
||||
MappingType::Folder => create_dir_all(local_target)
|
||||
.await
|
||||
.into_diagnostic()
|
||||
.wrap_err("Failed to create target folder")?,
|
||||
MappingType::File => write(local_target, "")
|
||||
.await
|
||||
.into_diagnostic()
|
||||
.wrap_err("Failed to create target file")?,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue