aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-11-27 12:11:34 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-11-30 08:00:40 +0900
commit04511b994e19de65fff84dd55a246842a2f9ad29 (patch)
tree8ab479f6418e122b6e94634e01ebe106efccd246 /lib
parentd82c541ae439b3c28ec71e9d6b839c2f304df273 (diff)
downloadruby-04511b994e19de65fff84dd55a246842a2f9ad29.tar.gz
Remove re-define embedded error classes and extract argument on custom error classes
Diffstat (limited to 'lib')
-rw-r--r--lib/matrix.rb20
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 690f98f3aa..0f4e1b2cf4 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -15,18 +15,6 @@
require_relative "matrix/version"
module ExceptionForMatrix # :nodoc:
- class TypeError
- def initialize(val)
- "wrong argument type #{val} (expected #{val})"
- end
- end
-
- class ArgumentError
- def initialize(val)
- "Wrong # of arguments(#{val} for #{val})"
- end
- end
-
class ErrDimensionMismatch < StandardError
def initialize
super("\#{self.name} dimension mismatch")
@@ -40,14 +28,14 @@ module ExceptionForMatrix # :nodoc:
end
class ErrOperationNotDefined < StandardError
- def initialize(val)
- super("Operation(#{val}) can\\'t be defined: #{val} op #{val}")
+ def initialize(op, sc, oc)
+ super("Operation(#{op}) can\\'t be defined: #{sc} op #{oc}")
end
end
class ErrOperationNotImplemented < StandardError
- def initialize(val)
- super("Sorry, Operation(#{val}) not implemented: #{val} op #{val}")
+ def initialize(op, sc, oc)
+ super("Sorry, Operation(#{op}) not implemented: #{sc} op #{oc}")
end
end
end