로깅 보완

This commit is contained in:
leejinho 2020-03-26 14:54:00 +09:00
parent 30c0013cc0
commit f1e789cbb6
2 changed files with 22 additions and 3 deletions

View File

@ -7,7 +7,8 @@ import {
shell, shell,
dialog, dialog,
BrowserWindow, BrowserWindow,
clipboard clipboard,
crashReporter
} from 'electron'; } from 'electron';
import path from 'path'; import path from 'path';
import fse from 'fs-extra'; import fse from 'fs-extra';
@ -133,6 +134,12 @@ function getUptimeInSeconds() {
return (now() - launchTime) / 1000; return (now() - launchTime) / 1000;
} }
crashReporter.start({
productName: app.name,
companyName: app.getVersion(),
submitURL: 'https//localhost'
});
process.on('uncaughtException', (error: Error) => { process.on('uncaughtException', (error: Error) => {
// error = withSourceMappedStack(error); // error = withSourceMappedStack(error);
// reportError(error, getExtraErrorContext()); // reportError(error, getExtraErrorContext());
@ -212,6 +219,7 @@ function createWindow() {
} }
window.onClose(() => { window.onClose(() => {
process.crash();
appWindow = null; appWindow = null;
if (!__DARWIN__ && !preventQuit) { if (!__DARWIN__ && !preventQuit) {
app.quit(); app.quit();
@ -671,9 +679,18 @@ ipcMain.on(
properties: ['openDirectory'] properties: ['openDirectory']
}) })
.then(value => { .then(value => {
event.returnValue = value.filePaths[0]; if (!!value) {
event.returnValue = value.filePaths[0];
} else {
log.error(
'[IpcMain / SelectDirectory]',
'Value is null or undefined'
);
event.returnValue = undefined;
}
}) })
.catch(reason => { .catch(reason => {
log.error('[IpcMain / SelectDirectory]', reason);
event.returnValue = undefined; event.returnValue = undefined;
}); });
} }

View File

@ -62,7 +62,9 @@ export class ChatComponent implements OnInit {
this.emit({ ...this.setting, downloadPath: path }); this.emit({ ...this.setting, downloadPath: path });
} }
}) })
.catch(reason => {}); .catch(reason => {
this.nativeService.appLogging(reason);
});
} }
private emit(setting: ChatSetting) { private emit(setting: ChatSetting) {