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

SystemError: Fix inconsistent signature. #11002

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions spec/std/system_error_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "spec"

describe SystemError do
describe ".from_os_error" do
it "Can build an error from an errno" do
errno = Errno.new(2)
error = ::IO::Error.from_os_error(message: nil, os_error: errno)
error.message.should eq("No such file or directory")
end
end
end
2 changes: 1 addition & 1 deletion src/system_error.cr
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module SystemError
#
# By default it returns the original message unchanged. But that could be
# customized based on the keyword arguments passed to `from_errno` or `from_winerror`.
protected def build_message(message, **opts) : String
protected def build_message(message : String?, **opts) : String?
message
end

Expand Down