mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
Restructure project directories (#333)
`/client/web` -> `/frontend` `/client/cli` -> *delete for now* `/client/native` -> *delete for now* `/core/editor` -> `/editor` `/core/document` -> `/graphene` `/core/renderer` -> `/charcoal` `/core/proc-macro` -> `/proc-macros` *(now plural)*
This commit is contained in:
35
editor/src/misc/error.rs
Normal file
35
editor/src/misc/error.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use crate::Color;
|
||||
use graphene::DocumentError;
|
||||
use thiserror::Error;
|
||||
|
||||
/// The error type used by the Graphite editor.
|
||||
#[derive(Clone, Debug, Error)]
|
||||
pub enum EditorError {
|
||||
#[error("Failed to execute operation: {0}")]
|
||||
InvalidOperation(String),
|
||||
#[error("{0}")]
|
||||
Misc(String),
|
||||
#[error("Tried to construct an invalid color {0:?}")]
|
||||
Color(String),
|
||||
#[error("The requested tool does not exist")]
|
||||
UnknownTool,
|
||||
#[error("The operation caused a document error {0:?}")]
|
||||
Document(String),
|
||||
#[error("A Rollback was initated but no transaction was in progress")]
|
||||
NoTransactionInProgress,
|
||||
}
|
||||
|
||||
macro_rules! derive_from {
|
||||
($type:ty, $kind:ident) => {
|
||||
impl From<$type> for EditorError {
|
||||
fn from(error: $type) -> Self {
|
||||
EditorError::$kind(format!("{:?}", error))
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
derive_from!(&str, Misc);
|
||||
derive_from!(String, Misc);
|
||||
derive_from!(Color, Color);
|
||||
derive_from!(DocumentError, Document);
|
||||
Reference in New Issue
Block a user