improved error handling
All checks were successful
Version Check / check-version (pull_request) Successful in 3s

This commit is contained in:
2026-03-18 17:19:09 +01:00
parent 5056f8dd0a
commit 277d8aa151
7 changed files with 37 additions and 58 deletions

View File

@@ -1,12 +1,12 @@
use super::{ConfigItem, FormatHandler, ItemStatus, ValueType};
use std::fs;
use std::io::{self, Write};
use std::io::Write;
use std::path::Path;
pub struct EnvHandler;
impl FormatHandler for EnvHandler {
fn parse(&self, path: &Path) -> io::Result<Vec<ConfigItem>> {
fn parse(&self, path: &Path) -> anyhow::Result<Vec<ConfigItem>> {
let content = fs::read_to_string(path)?;
let mut vars = Vec::new();
@@ -35,7 +35,7 @@ impl FormatHandler for EnvHandler {
Ok(vars)
}
fn write(&self, path: &Path, vars: &[ConfigItem]) -> io::Result<()> {
fn write(&self, path: &Path, vars: &[ConfigItem]) -> anyhow::Result<()> {
let mut file = fs::File::create(path)?;
for var in vars {
if !var.is_group {