Skip to content

fix(config): better config parse errors#1691

Merged
andrinoff merged 2 commits into
floatpane:masterfrom
kawacukennedy:feat/friendly-config-error
Jul 24, 2026
Merged

fix(config): better config parse errors#1691
andrinoff merged 2 commits into
floatpane:masterfrom
kawacukennedy:feat/friendly-config-error

Conversation

@kawacukennedy

@kawacukennedy kawacukennedy commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What?

Wrap config file parse errors with the file path, and replace the panic() in defaultKeybinds() with a logged warning.

Why?

Closes #1520

When a config file is malformed, the error only showed a raw JSON parse error with no indication of which file was broken. Users had no way to know what to fix.

If the embedded default_keybinds.json was somehow corrupted, the application crashed with a panic instead of degrading gracefully.

- Wrap the JSON parse error in LoadConfig with the config file path
  so users know which file has the problem (fixes floatpane#1520).
- Replace panic on malformed embedded default_keybinds.json with a
  logged warning that returns empty keybinds, preventing a crash
  from corrupted embedded data.
@kawacukennedy
kawacukennedy requested a review from a team as a code owner July 20, 2026 00:53

@floatpanebot floatpanebot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @kawacukennedy! Please fix the following issues with your PR:

  • Title: Is too long (69 characters). The PR title must be strictly under 40 characters.
  • Body: Missing the ## What? or ## Why? headings required by the PR template.

@floatpanebot floatpanebot added the area/config Configuration / settings label Jul 20, 2026
@kawacukennedy kawacukennedy changed the title fix(config): wrap malformed config error with file path, remove panic fix(config): better config parse errors Jul 20, 2026
@floatpanebot
floatpanebot dismissed their stale review July 20, 2026 01:33

Formatting issues have been resolved. Thank you!

@floatpanebot floatpanebot added the size/XS Diff: 0–10 lines label Jul 20, 2026
@andrinoff
andrinoff added this pull request to the merge queue Jul 24, 2026
@floatpanebot floatpanebot added the backport/v1 Merge to master and backport to release/v1 label Jul 24, 2026
Merged via the queue into floatpane:master with commit ed44a8f Jul 24, 2026
29 checks passed
floatpanebot pushed a commit that referenced this pull request Jul 24, 2026
## What?

Wrap config file parse errors with the file path, and replace the
`panic()` in `defaultKeybinds()` with a logged warning.

## Why?

Closes #1520

When a config file is malformed, the error only showed a raw JSON parse
error with no indication of which file was broken. Users had no way to
know what to fix.

If the embedded `default_keybinds.json` was somehow corrupted, the
application crashed with a panic instead of degrading gracefully.

---------

Co-authored-by: kawacukennedy <kennedykawacu@gmail.com>
(cherry picked from commit ed44a8f)
@floatpanebot floatpanebot added the backported Cherry-picked onto release/v1 label Jul 24, 2026
@floatpane floatpane deleted a comment from andrinoff Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Configuration / settings backport/v1 Merge to master and backport to release/v1 backported Cherry-picked onto release/v1 size/XS Diff: 0–10 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEAT: Friendly error message on malformed config file

3 participants