-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
65 lines (61 loc) · 1.7 KB
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'use strict'
const electron = require('electron')
const app = electron.app
const path = require('path')
// const raven = require('raven')
const json = require('./package.json')
// const ravenClient = new raven.Client(json.pubuim.ravenUrl, {
// logger: 'javascript',
// maxMessageLength: 1000
// })
const dialog = electron.dialog
const iconPath = path.resolve(__dirname, './res/app.png')
exports.handleError = function (error, extra, isShowError) {
// if (typeof extra === "boolean") {
// isShowError = extra
// extra = {}
// }
//
// // Handle the error
// try {
// ravenClient.captureError(error, {
// extra: extra || {},
// tags: {
// version: json.version
// }
// })
// } catch (err) {
// console.log('Raven error', err)
// }
//
// if (isShowError) exports.showError(error)
}
// exports.showError = function (error) {
// dialog.showErrorBox('应用出了点问题,我们会尽快解决', [
// error.toString(),
// "\n",
// "如果影响到您使用请尽快联系我们",
// "微博: rongcloudim",
// "微信: rongcloudim",
// "邮箱: [email protected]"
// ].join("\n"))
// }
exports.showError = function (error) {
dialog.showErrorBox(app.__('main.UncaughtException.Title'), [
error.toString(),
"\n",
app.__('main.UncaughtException.Content'),
app.__('main.UncaughtException.Website') + ": http://www.rongcloud.cn",
app.__('main.UncaughtException.Email') + ": [email protected]"
].join("\n"))
}
exports.showMessage = function (type, message, title, detail) {
dialog.showMessageBox({
type: type,
buttons: ['OK'],
icon: iconPath,
message: message,
title: title,
detail: detail
})
}