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

Fix Elixir 1.17 type error #70

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

fhunleth
Copy link
Contributor

@fhunleth fhunleth commented Sep 25, 2024

This fixes this error message:

    warning: unknown key .message in expression:

        maybe_json_parser_exception.message

    where "maybe_json_parser_exception" was given the type:

        # type: %{..., __exception__: true, __struct__: atom()}
        # from: lib/slipstream/serializer/phoenix_socket_v2_serializer.ex:65
        rescue maybe_json_parser_exception ->

    hint: when you rescue without specifying exception names, the variable is assigned a type of a struct but all of its fields are unknown. If you are trying to access an exception's :message key, either specify the exception names or use `Exception.message/1`.

    typing violation found at:
    │
 68 │           [message: maybe_json_parser_exception.message],
    │                                                 ~~~~~~~
    │
    └─ lib/slipstream/serializer/phoenix_socket_v2_serializer.ex:68:49: Slipstream.Serializer.PhoenixSocketV2Serializer.encode!/2

```
    warning: unknown key .message in expression:

        maybe_json_parser_exception.message

    where "maybe_json_parser_exception" was given the type:

        # type: %{..., __exception__: true, __struct__: atom()}
        # from: lib/slipstream/serializer/phoenix_socket_v2_serializer.ex:65
        rescue maybe_json_parser_exception ->

    hint: when you rescue without specifying exception names, the variable is assigned a type of a struct but all of its fields are unknown. If you are trying to access an exception's :message key, either specify the exception names or use `Exception.message/1`.

    typing violation found at:
    │
 68 │           [message: maybe_json_parser_exception.message],
    │                                                 ~~~~~~~
    │
    └─ lib/slipstream/serializer/phoenix_socket_v2_serializer.ex:68:49: Slipstream.Serializer.PhoenixSocketV2Serializer.encode!/2
```
Copy link
Collaborator

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@the-mikedavis the-mikedavis merged commit f4d7476 into NFIBrokerage:main Sep 26, 2024
3 checks passed
@fhunleth fhunleth deleted the fix-type-error branch September 26, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants