chg show error messagebox

This commit is contained in:
monoid 2021-01-12 16:10:05 +09:00
parent 42a1483225
commit ec5465f2d2

14
app.ts
View File

@ -1,4 +1,4 @@
import { app, BrowserWindow, session } from "electron"; import { app, BrowserWindow, session, dialog } from "electron";
import { get_setting } from "./src/setting"; import { get_setting } from "./src/setting";
import { create_server, start_server } from "./src/server"; import { create_server, start_server } from "./src/server";
import { getAdminAccessTokenValue,getAdminRefreshTokenValue, accessTokenName, refreshTokenName } from "./src/login"; import { getAdminAccessTokenValue,getAdminRefreshTokenValue, accessTokenName, refreshTokenName } from "./src/login";
@ -39,10 +39,18 @@ if (!setting.cli) {
} }
catch(e){ catch(e){
if(e instanceof Error){ if(e instanceof Error){
await wnd.webContents.executeJavaScript(`document.querySelector("body").innerHTML="<h1>${e.message}</h1>"`) await dialog.showMessageBox({
type: "error",
title:"error!",
message:e.message,
});
} }
else{ else{
await wnd.webContents.executeJavaScript(`document.querySelector("body").innerHTML="<h1>${e}</h1>"`) await dialog.showMessageBox({
type: "error",
title:"error!",
message:String(e),
});
} }
} }
wnd.on("closed", () => { wnd.on("closed", () => {