Skip to content

redis:connect() crashes on db unavailability #1

@paul-mhq

Description

@paul-mhq

Maybe I'm missing something, but it seems to me that if I run redis:connect() when the redis db is down, the client process crashes (i.e. some linked process seems to send an exit signal from redis_client:init/1). This can't be caught with try/catch and the only way seems to be trapexit. This seems weird because the success case return value is {ok, Connection} which would make me expect the error return to be {error, Something}.

Am I making some dumb error? Is there a less drastic way to handle the situation? I'm not that fluent in Erlang so I could be overlooking something.

I opened an Erlang-questions thread starting here:

http://erlang.org/pipermail/erlang-questions/2013-June/074093.html

and a couple people suggested that connection failure should return an error code instead of craashing.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions