Class: Embulk::DataError
- Inherits:
-
Java::SPI::DataException
- Object
- Java::SPI::DataException
- Embulk::DataError
- Defined in:
- lib/embulk/error.rb
Overview
DataError is not a ::StandardError but is a java.lang.RuntimeException. “rescue => e” can rescues DataError.
Instance Method Summary collapse
-
#initialize(*arguments) ⇒ DataError
constructor
:call-seq: DataError.new() DataError.new(string).
Constructor Details
#initialize(*arguments) ⇒ DataError
:call-seq:
DataError.new()
DataError.new(string)
Returns the new DataError object.
The signature of DataError.new accepts any argument. But in fact, it accepts only DataError.new() and DataError.new(String). It raises Error: org.jruby.exceptions.Argument otherwise. It has been like this since Embulk v0.10.38 because a subclass of a Java class is a full Java class as of JRuby 9.3, which introduced some restrictions.
See also:
History
DataError.initialize receives only a variable-length argument list (rest parameters) since Embulk v0.10.38. It is to satisfy restrictions as of JRuby 9.3.
It was DataError.initialize(message=nil) before v0.10.38. It switched over to call super() (ConfigException()), or super(String) (ConfigException(String)) based on message. It was because Ruby does not allow method overloading, and then, DataError can have only a single initialize method.
On the other hand, JRuby 9.3+ does not allow initialize to contain multiple super calls in it. Switching the superclass constructor is no longer accepted in JRuby 9.3+.
To keep compatibility from caller’s viewpoint, DataError.initialize receives only a variable-length argument list (*arguments), and calls the superclass constructor with super (without parenthesis). It allows DataError.new() and DataError.new(String) to call an appropriate superclass constructor for each.
However, DataError.new now accepts any argument undesirably. It raises an unexpected Error: org.jruby.exceptions.ArgumentError when DataError.new is called with an unexpected argument.
96 97 98 |
# File 'lib/embulk/error.rb', line 96 def initialize(*arguments) super end |