Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config validation; duplicate key wrong error #8419

Closed
Bad3r opened this issue Jan 23, 2023 · 1 comment · Fixed by #8488
Closed

Config validation; duplicate key wrong error #8419

Bad3r opened this issue Jan 23, 2023 · 1 comment · Fixed by #8488
Labels
good first issue Good for newcomers :type/enhancement Enhancement to product. Does not affect the overall basic use. user-config User configuration e.g. ~/.logseq/config or logseq/*.edn

Comments

@Bad3r
Copy link
Collaborator

Bad3r commented Jan 23, 2023

Error in Logseq:

Failed to read file 'Pandora/logseq/config.edn'. Make sure your config is wrapped
in {}. Also make sure that the characters '( { [' have their corresponding closing character ') } ]'.

I triggered this error while testing what happens when you have a duplicate key.

Steps to reproduce:

  1. open config.edn and duplicate any config key/value
  2. Logseq displays unrelated error

side-note

in the previous version; when a config is duplicate; Logseq used to consider the config file broken.
I think the way duplicate config should be handled is that;
the last occurrence gets to set the value for the key.

i.e. if the config file contained:

 :ref/default-open-blocks-level 2
 :ref/default-open-blocks-level 3

the value of :ref/default-open-blocks-level would be 3.
Logseq can display a warning, but it should continue to
work as expected.

@Bad3r Bad3r added the user-config User configuration e.g. ~/.logseq/config or logseq/*.edn label Jan 23, 2023
@Bad3r Bad3r changed the title Config validation; wrong error Config validation; duplicate key wrong error Jan 24, 2023
@logseq-cldwalker
Copy link
Collaborator

logseq-cldwalker commented Jan 24, 2023

Agree it could be nice to have a more specific error message for this case. Looks like the error message thrown makes this doable. Leaving this open as a good first issue for whomever

For whomever takes this on, please use notfication/show! to display the error and the error to be caught is in validate-config-edn

@logseq-cldwalker logseq-cldwalker added :type/enhancement Enhancement to product. Does not affect the overall basic use. good first issue Good for newcomers labels Jan 24, 2023
@logseq-cldwalker logseq-cldwalker removed their assignment Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers :type/enhancement Enhancement to product. Does not affect the overall basic use. user-config User configuration e.g. ~/.logseq/config or logseq/*.edn
Projects
Development

Successfully merging a pull request may close this issue.

2 participants