Closed straight-shoota closed 4 years ago
FYI crystal-db is been updated for 0.34.0 also.
Cool, thanks. @bcardiff should we also do a cyrstal-db update in the same release as this?
I would say so. crystal-db: ~> 0.9.0
will work fine on Crystal 0.34.0 (and some versions before).
While I was checking a change similar to this PR in ecosystem I did, for 0.34.0 the following change. Avoiding the access to os_error.
begin
handle_async_frames(read_one_frame(soc.read_char))
rescue e : IO::Error
@soc.closed? ? break : raise e
end
If support for non-latest crystal version is wanted, the following will do.
{% if compare_versions(Crystal::VERSION, "0.34.0-0") > 0 %}
begin
handle_async_frames(read_one_frame(soc.read_char))
rescue e : IO::Error
@soc.closed? ? break : raise e
end
{% else %}
begin
handle_async_frames(read_one_frame(soc.read_char))
rescue e : Errno
e.errno == Errno::EBADF && @soc.closed? ? break : raise e
rescue e : IO::Error
# Before 0.34 IO::Error was raised also in some situations
@soc.closed? ? break : raise e
end
{% end %}
Is up to you, and I might be missing some subtles errors, but I couldn't find issues with the general catch.
I suppose checking for @soc.closed?
on IO::Error
should be sufficient.
FYI crystal-db 0.9.0 is already available.
This PR updates for compatibility with newly release Crystal 0.34.0 addressing the breaking changes from crystal-lang/crystal#8885 and crystal-lang/crystal#8424.