From: Nobuyoshi Nakada Date: 2012-01-16T11:03:41+09:00 Subject: [ruby-core:42143] Re: [ruby-trunk - Feature #5898][Open] raise and Exception#initialize 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