mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-17 16:19:51 +00:00
treewide: improve logging; custom error types with thiserror
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a696464e4123d15cfaedf4727776e55948369
This commit is contained in:
parent
7dd3db4c88
commit
6e21021306
10 changed files with 221 additions and 166 deletions
|
|
@ -2,13 +2,26 @@ use crate::db::{ClipboardDb, SledClipboardDb};
|
|||
|
||||
use std::io::{Read, Write};
|
||||
|
||||
use crate::db::StashError;
|
||||
|
||||
pub trait DecodeCommand {
|
||||
fn decode(&self, in_: impl Read, out: impl Write, input: Option<String>);
|
||||
fn decode(
|
||||
&self,
|
||||
in_: impl Read,
|
||||
out: impl Write,
|
||||
input: Option<String>,
|
||||
) -> Result<(), StashError>;
|
||||
}
|
||||
|
||||
impl DecodeCommand for SledClipboardDb {
|
||||
fn decode(&self, in_: impl Read, out: impl Write, input: Option<String>) {
|
||||
self.decode_entry(in_, out, input);
|
||||
fn decode(
|
||||
&self,
|
||||
in_: impl Read,
|
||||
out: impl Write,
|
||||
input: Option<String>,
|
||||
) -> Result<(), StashError> {
|
||||
self.decode_entry(in_, out, input)?;
|
||||
log::info!("Entry decoded");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue