mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-09-14 08:45:01 +00: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:
parent
c8389bbae1
commit
d290aaf712
16 changed files with 212 additions and 32 deletions
|
@ -28,6 +28,7 @@ export enum ResponseType {
|
|||
SetCanvasZoom = "SetCanvasZoom",
|
||||
SetCanvasRotation = "SetCanvasRotation",
|
||||
DisplayError = "DisplayError",
|
||||
DisplayPanic = "DisplayPanic",
|
||||
DisplayConfirmationToCloseDocument = "DisplayConfirmationToCloseDocument",
|
||||
DisplayConfirmationToCloseAllDocuments = "DisplayConfirmationToCloseAllDocuments",
|
||||
}
|
||||
|
@ -43,8 +44,10 @@ export function handleResponse(responseType: string, responseData: any) {
|
|||
if (callback && data) {
|
||||
callback(data);
|
||||
} else if (data) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`Received a Response of type "${responseType}" but no handler was registered for it from the client.`);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`Received a Response of type "${responseType}" but but was not able to parse the data.`);
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +86,8 @@ function parseResponse(responseType: string, data: any): Response {
|
|||
return newUpdateWorkingColors(data.UpdateWorkingColors);
|
||||
case "DisplayError":
|
||||
return newDisplayError(data.DisplayError);
|
||||
case "DisplayPanic":
|
||||
return newDisplayPanic(data.DisplayPanic);
|
||||
case "DisplayConfirmationToCloseDocument":
|
||||
return newDisplayConfirmationToCloseDocument(data.DisplayConfirmationToCloseDocument);
|
||||
case "DisplayConfirmationToCloseAllDocuments":
|
||||
|
@ -144,10 +149,23 @@ function newSetActiveDocument(input: any): SetActiveDocument {
|
|||
}
|
||||
|
||||
export interface DisplayError {
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
function newDisplayError(input: any): DisplayError {
|
||||
return {
|
||||
title: input.title,
|
||||
description: input.description,
|
||||
};
|
||||
}
|
||||
|
||||
export interface DisplayPanic {
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
function newDisplayPanic(input: any): DisplayPanic {
|
||||
return {
|
||||
title: input.title,
|
||||
description: input.description,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue