Skip to content

I wonder about the quality of the code for use in production. #1

@oderwat

Description

@oderwat

I gave this package a quick look today, because I am going to use Syn in one of our Gleam projects that uses a cluster.

When I see it right, the following code makes an error check on "syn:publish" which actually never returns an error (docs). But it can raise and that is not caught here (and in a lot of other places). One may expect a function that returns a Result to not crash and actually gives back an error.

glyn/src/glyn/pubsub.gleam

Lines 294 to 299 in 3207158

// Publish the tagged message through syn
case syn_publish(pubsub.scope, group, to_dynamic(message)) {
Ok(_) -> Ok(Nil)
Error(reason) ->
Error(PublishFailed("publish failed: " <> string.inspect(reason)))
}

I did not find a test for this either. But I found error_handling_test() which actually does not test errors but tests if stuff is going through anyway. But that is nitpicking.

Do I misinterpret something or is that a result of AI code generation?

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