Skip to content

Better Error Messages for Known-but-Unsupported Signals #15226

@Petruchio

Description

@Petruchio

Elixir and Erlang/OTP versions

Greetings. I debated whether this counted as a feature request or an issue report, and I decided it was the latter.

As a new user, I embarked on a project and decided I wanted to catch Ctrl-c for my own behavior. After much travail, including grepping the source code, I came to the understanding that capturing SIGINT is not supported. I expect this policy has been well-discussed, but given that it is so, let me suggest that Elixir error messages should offer some insight into this. If I was to call a function with something strange like :sigpenguin, a bewildered "invalid signal name" error seems appropriate. When I try something like :sigint, you know what I mean; just tell me I can't do that.

The fix for this seems simple: maintain a list of known-but-unsupported signals, and when they are attempted, return a more appropriate error, and perhaps point the coder in the right direction for information. This would be immensely helpful for people coming from other traditions, who will invariably believe that this is something they can do, they just haven't figured out how, yet.

Operating system

Linux

Current behavior

  • 1st argument: invalid signal name

    (kernel 8.2) :os.set_signal(:sigint, :handle)

Expected behavior

  • 1st argument: Handling :sigint is not supported. See the documentation at [wherever].

    (kernel 8.2) :os.set_signal(:sigint, :handle)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions