mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Show a crash dialog when the editor panics (#362)
* Show a crash dialog when the editor panics Closes #357 * Suppress console usage lints * Proxy cleanup and comments
This commit is contained in:
@@ -202,7 +202,13 @@ impl MessageHandler<DocumentsMessage, &InputPreprocessor> for DocumentsMessageHa
|
||||
Ok(document) => {
|
||||
self.load_document(document, responses);
|
||||
}
|
||||
Err(e) => responses.push_back(FrontendMessage::DisplayError { description: e.to_string() }.into()),
|
||||
Err(e) => responses.push_back(
|
||||
FrontendMessage::DisplayError {
|
||||
title: "Failed to open document".to_string(),
|
||||
description: e.to_string(),
|
||||
}
|
||||
.into(),
|
||||
),
|
||||
}
|
||||
}
|
||||
GetOpenDocumentsList => {
|
||||
|
||||
@@ -12,7 +12,8 @@ pub enum FrontendMessage {
|
||||
SetActiveTool { tool_name: String, tool_options: Option<ToolOptions> },
|
||||
SetActiveDocument { document_index: usize },
|
||||
UpdateOpenDocumentsList { open_documents: Vec<String> },
|
||||
DisplayError { description: String },
|
||||
DisplayError { title: String, description: String },
|
||||
DisplayPanic { title: String, description: String },
|
||||
DisplayConfirmationToCloseDocument { document_index: usize },
|
||||
DisplayConfirmationToCloseAllDocuments,
|
||||
UpdateCanvas { document: String },
|
||||
|
||||
@@ -41,8 +41,10 @@ impl Editor {
|
||||
|
||||
pub fn handle_message<T: Into<Message>>(&mut self, message: T) -> Vec<FrontendMessage> {
|
||||
self.dispatcher.handle_message(message);
|
||||
|
||||
let mut responses = Vec::new();
|
||||
std::mem::swap(&mut responses, &mut self.dispatcher.responses);
|
||||
|
||||
responses
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user