Hi,

(12/01/16 10:03), Thomas Sawyer wrote:
>   class MyError < Exception
>     def initialize(a,b)
>       super("#{a} and #{b}")
>     end
>   end
> 
>   raise MyError, 'foo', 'bar'

Try:

  class MyError < RuntimeError
    def initialize(args)
      a, b = *args
      super("#{a} and #{b}")
    end
  end

  raise MyError, ['foo', 'bar']


> So I propose a second best approach. Notice that if `caller` is
> passed to `#raise` it is not being passed on to the `#initialize`
> method unlike the `message` argument. Instead `#set_backtrace` is
> being used to set the caller. I propose that the `message` argument
> be handled in the same way, and a new method `#set_message(msg)` be
> added to the `Exception` class to handle it.

How do you tell if the second argument is a part of messages, or a
caller?

-- 
Nobu Nakada