Skip to content

Instantly share code, notes, and snippets.

@r7kamura
Created May 29, 2020 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r7kamura/9542e2a14433b7f40b0f693b34828779 to your computer and use it in GitHub Desktop.
Save r7kamura/9542e2a14433b7f40b0f693b34828779 to your computer and use it in GitHub Desktop.
class MyError < StandardError
def initialize(**options)
p options
end
end
raise MyError, foo: :bar
@r7kamura
Copy link
Author

$ ruby /Users/r7kamura/Desktop/raise_kwargs_test.rb
/Users/r7kamura/Desktop/raise_kwargs_test.rb:7: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/r7kamura/Desktop/raise_kwargs_test.rb:2: warning: The called method `initialize' is defined here
{:foo=>:bar}
Traceback (most recent call last):
/Users/r7kamura/Desktop/raise_kwargs_test.rb:7:in `<main>': MyError (MyError)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment