Working Error Logging

This commit is contained in:
Neshura 2023-12-17 22:29:18 +01:00
parent bba7fae8b9
commit 47e6cc59c0
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
7 changed files with 253 additions and 123 deletions
src/config

View file

@ -1,4 +1,3 @@
use std::{error::Error};
use serde_derive::{Deserialize, Serialize};
use crate::config::PostBody::Description;
@ -11,8 +10,11 @@ pub(crate) struct Config {
}
impl Config {
pub(crate) fn load() -> Result<Self, Box<dyn Error>> {
let cfg: Self = confy::load_path("./config.toml")?;
pub(crate) fn load() -> Result<Self, String> {
let cfg: Self = match confy::load_path("./config.toml") {
Ok(data) => data,
Err(_) => panic!("config.toml not found!"),
};
if cfg.instance.is_empty() {
panic!("config.toml not found!")
}