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

Crystal 0.34.0 #203

Merged
merged 2 commits into from
Apr 6, 2020
Merged

Crystal 0.34.0 #203

merged 2 commits into from
Apr 6, 2020

Conversation

straight-shoota
Copy link
Contributor

@straight-shoota straight-shoota commented Apr 6, 2020

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.

Errno exception type has been replaced in 0.34.0 by more specific types
Starting with Crystal 0.34.0 case expressions issue a warning when
exhaustiveness can't be proven. This adds the missing else branches to
encode the default behaviour.
@bcardiff
Copy link
Collaborator

bcardiff commented Apr 6, 2020

FYI crystal-db is been updated for 0.34.0 also.

@will
Copy link
Owner

will commented Apr 6, 2020

Cool, thanks. @bcardiff should we also do a cyrstal-db update in the same release as this?

@will will merged commit c6448b7 into will:master Apr 6, 2020
@straight-shoota straight-shoota deleted the crystal-0.34.0 branch April 6, 2020 23:07
@bcardiff
Copy link
Collaborator

bcardiff commented Apr 6, 2020

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.

@straight-shoota
Copy link
Contributor Author

I suppose checking for @soc.closed? on IO::Error should be sufficient.

@bcardiff
Copy link
Collaborator

bcardiff commented Apr 7, 2020

FYI crystal-db 0.9.0 is already available.

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.

3 participants