mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 22:43:11 +02:00
Make rendering return Result, and handle infinite recursion
This commit is contained in:
22
src-tauri/yaak-templates/src/error.rs
Normal file
22
src-tauri/yaak-templates/src/error.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use serde::{Serialize, Serializer};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug, PartialEq)]
|
||||
pub enum Error {
|
||||
#[error("Render Error: {0}")]
|
||||
RenderError(String),
|
||||
|
||||
#[error("Render Error: Max recursion depth exceeded")]
|
||||
RenderStackExceededError,
|
||||
}
|
||||
|
||||
impl Serialize for Error {
|
||||
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
serializer.serialize_str(self.to_string().as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
Reference in New Issue
Block a user