Skip to content

improve error message when mfdata is not started #464

@matthieumarrast

Description

@matthieumarrast

When mfdata is not started, an error stack trace ending with connecting to unix socket: /home/mfdata/var/redis.socket. No such file or directory is shown to the user :

  File "/opt/metwork-mfext-2.1/opt/python3/lib/python3.10/site-packages/redis/client.py", line 1235, in execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
  File "/opt/metwork-mfext-2.1/opt/python3/lib/python3.10/site-packages/redis/connection.py", line 1387, in get_connection
    connection.connect()
  File "/opt/metwork-mfext-2.1/opt/python3/lib/python3.10/site-packages/redis/connection.py", line 617, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 2 connecting to unix socket: /home/mfdata/var/redis.socket. No such file or directory.

It's not really readable for an user who maybe doesn't know that redis is used inside mfdata.

So it should be better to catch the error and to display an understandable message to the user, for example:
The redis socket is not found. You must start the mfdata module before using it.
or
It seems mfdata is not started. Start the module before use.

You can reproduce it by stopping mfdata and trying to inject a file using inject_file --incoming <file>

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