Skip to content

WebSocket client hiding errors thrown from within do block #1067

@bryaan

Description

@bryaan

The websocket client is catching errors thrown from within the do block. The outer try catch never gets triggered and the server restarts unexpectedly. The only hack is to use a condition variable. This adds even more boilerplate. Can we fix this?

while true
    try
        WebSockets.open("wss://ws-feed.exchange.coinbase.com") do ws
            try
                error("test")

                for msg in ws
                end
            catch e
                @info "Inner try catch"
                rethrow(e)
            end
        end
    catch e
        @info "Outer try catch"
        rethrow(e)
    end
    @info "Restarting"
    sleep(2)
end

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