From 1ace6f147df05b47034c33f65370c50903bcd2d2 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 12 Sep 2014 21:19:25 -0500 Subject: [PATCH] Make exception subclasses use their superclass properly --- Library/Homebrew/exceptions.rb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index b9696f6232..a45a5de772 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -251,22 +251,13 @@ class ChecksumMismatchError < RuntimeError end class ResourceMissingError < ArgumentError - def initialize formula, resource - @formula = formula - @resource = resource - end - - def to_s - "Formula #{@formula} does not define resource \"#{@resource}\"." + def initialize(formula, resource) + super "#{formula} does not define resource #{resource.inspect}" end end class DuplicateResourceError < ArgumentError - def initialize resource - @resource = resource - end - - def to_s - "Resource \"#{@resource}\" defined more than once." + def initialize(resource) + super "Resource #{resource.inspect} is defined more than once" end end