Skip to content

Conversation

@shubham-padia
Copy link
Member

Fixes #1404.

Supersedes #1405. Since the content of the commit was very similar, I have added @sammamama as a co author.

I wasn't sure about quitting the app after the error so kept it as a separate commit if we want to skip it.

Screenshots and screen captures:
Screenshot 2025-06-06 at 1 15 16 PM

Platforms this PR was tested on:

  • Windows
  • macOS
  • Linux (specify distro)
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

shubham-padia and others added 2 commits June 6, 2025 13:48
Otherwise, the error will keep showing multiple times ultimately
leading to a non-working app after multiple errors.
@shubham-padia shubham-padia changed the title Invalid global config Show error dialog box on invalid global_config.json Jun 6, 2025
@timabbott
Copy link
Member

Would it make sense to show the actual JSON parser error message? Having a line number in the file to look at can help folks a lot. We could probably cut some of the text if we added that.

@shubham-padia
Copy link
Member Author

I set global_config.json to just be test for the below error message, changing it to valid JSON makes the app work again.

The message is not really useful, the stacktrace I get is the following.

endering chunks (1)...App threw an error during load
ReferenceError: Cannot access 'logger$7' before initialization
    at getConfigItem (/Users/shubhampadia/zulip-desktop/dist-electron/index.js:14239:5)
    at Object.<anonymous> (/Users/shubhampadia/zulip-desktop/dist-electron/index.js:14191:18)
    at Module._compile (node:internal/modules/cjs/loader:1569:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1722:10)
    at Module.load (node:internal/modules/cjs/loader:1296:32)
    at Module._load (node:internal/modules/cjs/loader:1115:12)
    at c._load (node:electron/js2c/node_init:2:18008)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:227:24)
    at cjsLoader (node:internal/modules/esm/translators:266:5)

which I think makes things more confusing. Might be better to just stick with the current generic message?

@timabbott timabbott merged commit 51ff949 into zulip:main Jun 18, 2025
1 check passed
@timabbott
Copy link
Member

Yeah, this seems fine given that, merged, thanks @shubham-padia!

@@ -1,8 +1,10 @@
import {app} from "electron/main";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work. We’re in app/common here, which is used from both the main process and the renderer process. We’re not allowed to use main process APIs. In practice, we get app === undefined in the renderer process.

Copy link
Member Author

@shubham-padia shubham-padia Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would #1430 be the right approach for rectifying this?

@andersk
Copy link
Member

andersk commented Jun 20, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error handling for invalid JSON in global_config.json

4 participants