8000 Misleading error message for problems with reading the config file · Issue #1381 · enketo/enketo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Misleading error message for problems with reading the config file #1381
Open
@mlazowik

Description

@mlazowik

Describe the bug
The code that reads the config file is wrapped in a single bare exception catch: https://github.com/enketo/enketo/blob/7.5.0/packages/enketo-express/app/models/config-model.js#L30

This means that for all of the following examples:

  • a missing file
  • lack of permission to read
  • syntax error in json parsing

the same error will get logged: No local config.json found. Will check environment variables instead.

To Reproduce

  1. For example purposefully break the config syntax by let's say a missing end quote on a string value.
  2. Observe the error message in the logs

Expected behavior
The error message should not mislead.

IMO if the problem is anything other than a missing file the processing should loudly fail instead of continuing – if the config file exists it's clearly meant to be read, so continuing with defaults could be risky if the defaults still mean that the service is able to start. It'll then silently have different config than expected.

Browser and OS (please complete the following information):

  • OS/browser – irrelevant
  • ghcr.io/enketo/enketo:7.5.0

Additional context
Even if the file is missing, it might be due to mistaken paths. So it might be better to have an explicit setting that says to use env vars, but I realize that would be a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0