Skip to content

Commit c0fdab6

Browse files
authored
error dialog is deltachat-rpc-server is not found (#4479)
closes #4469
1 parent 5dd6d77 commit c0fdab6

File tree

4 files changed

+46
-6
lines changed

4 files changed

+46
-6
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
- add show_app_in_chat option to webxdc info message context menu #4459
5252
- add experimental content protection option (to prevent screenshots and screenrecording the app) #4475
5353
- app picker for webxdc apps in attachement menu #4485
54+
- add special error dialog for the case that deltachat-rpc-server is not found #4479
5455

5556
### Changed
5657
- Update `@deltachat/stdio-rpc-server` and `deltachat/jsonrpc-client` to `1.154.1`

Diff for: packages/target-electron/src/deltachat/controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export default class DeltaChatController extends EventEmitter {
141141
serverPath
142142
)
143143

144-
await this.account_manager.start()
144+
this.account_manager.start()
145145
log.info('HI')
146146

147147
//todo? multiple instances, accounts is always writable

Diff for: packages/target-electron/src/deltachat/stdio_server.ts

+38-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ChildProcessWithoutNullStreams, spawn } from 'child_process'
33
import { app, dialog } from 'electron/main'
44
import { BuildInfo } from '../get-build-info'
55
import { arch, platform } from 'os'
6+
import { getLogsPath } from '../application-constants'
67

78
const log = getLogger('DC-RPC')
89

@@ -16,14 +17,50 @@ export class StdioServer {
1617
this.serverProcess = null
1718
}
1819

19-
async start() {
20+
start() {
2021
this.serverProcess = spawn(this.cmd_path, {
2122
env: {
2223
DC_ACCOUNTS_PATH: this.accounts_path,
2324
RUST_LOG: process.env.RUST_LOG,
2425
},
2526
})
2627

28+
this.serverProcess.on('error', err => {
29+
// The 'error' event is emitted whenever:
30+
// - The process could not be spawned.
31+
// - The process could not be killed.
32+
// - Sending a message to the child process failed.
33+
// - The child process was aborted via the signal option.
34+
// ~ https://nodejs.org/api/child_process.html#event-error
35+
36+
if (err.message.endsWith('ENOENT')) {
37+
dialog.showErrorBox(
38+
'Fatal Error: Core Library Missing',
39+
`The DeltaChat Module is missing! This could be due to your antivirus program. Please check the quarantine to restore it and notify the developers about this issue.
40+
You can reach us on [email protected] or on github.com/deltachat/deltachat-desktop/issues.
41+
42+
The missing module should be located at "${this.cmd_path}".
43+
44+
The Log file is located in this folder: ${getLogsPath()}
45+
--------------------
46+
Error: ${err.message}
47+
`
48+
)
49+
} else {
50+
dialog.showErrorBox(
51+
'Fatal Error',
52+
`Error with core has been detected, please contact developers: You can reach us on [email protected] or on github.com/deltachat/deltachat-desktop/issues .
53+
54+
${err.name}: ${err.message}
55+
56+
The Log file is located in this folder: ${getLogsPath()}\n
57+
`
58+
)
59+
}
60+
// I think we can exit in all the cases, because all errors here are serious
61+
app.exit(1)
62+
})
63+
2764
let buffer = ''
2865
this.serverProcess.stdout.on('data', data => {
2966
// console.log(`stdout: ${data}`)

Diff for: packages/target-electron/src/ipc.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,16 @@ export async function init(cwd: string, logHandler: LogHandler) {
6565
error,
6666
dcController.rpcServerPath
6767
)
68+
6869
dialog.showErrorBox(
6970
'Fatal Error',
7071
`The DeltaChat Module couldn't be loaded.
71-
Please check if all dependencies for deltachat-core are installed!
72-
The Log file is located in this folder: ${getLogsPath()}\n
73-
${dcController.rpcServerPath}\n
74-
${error instanceof Error ? error.message : inspect(error, { depth: null })}`
72+
Please check if all dependencies for deltachat-core are installed!
73+
The Log file is located in this folder: ${getLogsPath()}\n
74+
${dcController.rpcServerPath}\n
75+
${error instanceof Error ? error.message : inspect(error, { depth: null })}`
7576
)
77+
7678
rawApp.exit(1)
7779
}
7880

0 commit comments

Comments
 (0)