| 
									
										
										
										
											2011-03-12 23:06:45 -08:00
										 |  |  | class UsageError < RuntimeError; end | 
					
						
							|  |  |  | class FormulaUnspecifiedError < UsageError; end | 
					
						
							|  |  |  | class KegUnspecifiedError < UsageError; end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-12 23:06:45 -08:00
										 |  |  | class MultipleVersionsInstalledError < RuntimeError | 
					
						
							| 
									
										
										
										
											2013-02-17 22:52:39 -06:00
										 |  |  |   attr_reader :name | 
					
						
							| 
									
										
										
										
											2010-11-12 20:59:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def initialize name | 
					
						
							|  |  |  |     @name = name | 
					
						
							|  |  |  |     super "#{name} has multiple installed versions" | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class NotAKegError < RuntimeError; end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-12 23:06:45 -08:00
										 |  |  | class NoSuchKegError < RuntimeError | 
					
						
							| 
									
										
										
										
											2013-02-17 22:52:39 -06:00
										 |  |  |   attr_reader :name | 
					
						
							| 
									
										
										
										
											2010-11-12 20:59:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def initialize name | 
					
						
							|  |  |  |     @name = name | 
					
						
							|  |  |  |     super "No such keg: #{HOMEBREW_CELLAR}/#{name}" | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-13 17:40:12 -05:00
										 |  |  | class FormulaValidationError < StandardError | 
					
						
							|  |  |  |   attr_reader :attr | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize(attr, value) | 
					
						
							|  |  |  |     @attr = attr | 
					
						
							|  |  |  |     msg = "invalid attribute: #{attr}" | 
					
						
							|  |  |  |     msg << " (#{value.inspect})" unless value.empty? | 
					
						
							|  |  |  |     super msg | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-06 21:48:05 -07:00
										 |  |  | class FormulaSpecificationError < StandardError; end | 
					
						
							| 
									
										
										
										
											2013-04-27 14:44:48 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | class FormulaUnavailableError < RuntimeError | 
					
						
							| 
									
										
										
										
											2013-02-17 22:52:39 -06:00
										 |  |  |   attr_reader :name | 
					
						
							|  |  |  |   attr_accessor :dependent | 
					
						
							| 
									
										
										
										
											2012-03-16 11:55:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-28 15:58:20 -06:00
										 |  |  |   def initialize name | 
					
						
							|  |  |  |     @name = name | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-16 11:55:30 +00:00
										 |  |  |   def dependent_s | 
					
						
							|  |  |  |     "(dependency of #{dependent})" if dependent and dependent != name | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def to_s | 
					
						
							| 
									
										
										
										
											2014-02-28 15:58:20 -06:00
										 |  |  |     "No available formula for #{name} #{dependent_s}" | 
					
						
							| 
									
										
										
										
											2012-03-16 11:55:30 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2014-02-28 15:58:20 -06:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TapFormulaUnavailableError < FormulaUnavailableError | 
					
						
							|  |  |  |   attr_reader :user, :repo, :shortname | 
					
						
							| 
									
										
										
										
											2010-11-12 20:59:53 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   def initialize name | 
					
						
							| 
									
										
										
										
											2014-02-28 15:58:20 -06:00
										 |  |  |     super | 
					
						
							|  |  |  |     @user, @repo, @shortname = name.split("/", 3) | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def to_s; <<-EOS.undent
 | 
					
						
							|  |  |  |       No available formula for #{shortname} #{dependent_s} | 
					
						
							|  |  |  |       Please tap it and then try again: brew tap #{user}/#{repo} | 
					
						
							|  |  |  |     EOS | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  | class OperationInProgressError < RuntimeError | 
					
						
							|  |  |  |   def initialize name | 
					
						
							|  |  |  |     message = <<-EOS.undent
 | 
					
						
							|  |  |  |       Operation already in progress for #{name} | 
					
						
							|  |  |  |       Another active Homebrew process is already using #{name}. | 
					
						
							|  |  |  |       Please wait for it to finish or terminate it to continue. | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     super message | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | module Homebrew | 
					
						
							|  |  |  |   class InstallationError < RuntimeError | 
					
						
							| 
									
										
										
										
											2013-02-17 22:52:39 -06:00
										 |  |  |     attr_reader :formula | 
					
						
							| 
									
										
										
										
											2010-11-12 20:59:53 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-09 21:01:23 -08:00
										 |  |  |     def initialize formula, message="" | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |       super message | 
					
						
							|  |  |  |       @formula = formula | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-06 21:48:05 -07:00
										 |  |  | class CannotInstallFormulaError < RuntimeError; end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-06 21:48:05 -07:00
										 |  |  | class FormulaAlreadyInstalledError < RuntimeError; end | 
					
						
							| 
									
										
										
										
											2013-04-03 18:26:40 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | class FormulaInstallationAlreadyAttemptedError < Homebrew::InstallationError | 
					
						
							|  |  |  |   def message | 
					
						
							|  |  |  |     "Formula installation already attempted: #{formula}" | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-27 19:40:10 -06:00
										 |  |  | class UnsatisfiedDependencyError < Homebrew::InstallationError | 
					
						
							| 
									
										
										
										
											2014-02-27 14:22:43 -06:00
										 |  |  |   def initialize(f, dep, inherited_options) | 
					
						
							| 
									
										
										
										
											2013-01-27 19:40:10 -06:00
										 |  |  |     super f, <<-EOS.undent
 | 
					
						
							|  |  |  |     #{f} dependency #{dep} not installed with: | 
					
						
							| 
									
										
										
										
											2014-02-27 14:22:43 -06:00
										 |  |  |       #{dep.missing_options(inherited_options) * ', '} | 
					
						
							| 
									
										
										
										
											2013-01-27 19:40:10 -06:00
										 |  |  |     EOS | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-23 17:06:38 -07:00
										 |  |  | class UnsatisfiedRequirements < Homebrew::InstallationError | 
					
						
							| 
									
										
										
										
											2013-02-17 22:52:39 -06:00
										 |  |  |   attr_reader :reqs | 
					
						
							| 
									
										
										
										
											2012-07-23 17:06:38 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def initialize formula, reqs | 
					
						
							|  |  |  |     @reqs = reqs | 
					
						
							|  |  |  |     message = (reqs.length == 1) \ | 
					
						
							|  |  |  |                 ? "An unsatisfied requirement failed this build." \ | 
					
						
							|  |  |  |                 : "Unsatisifed requirements failed this build." | 
					
						
							|  |  |  |     super formula, message | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-27 02:07:29 -07:00
										 |  |  | class IncompatibleCxxStdlibs < Homebrew::InstallationError | 
					
						
							|  |  |  |   def initialize(f, dep, wrong, right) | 
					
						
							|  |  |  |     super f, <<-EOS.undent
 | 
					
						
							| 
									
										
										
										
											2014-02-02 02:12:57 -08:00
										 |  |  |     #{f} dependency #{dep} was built with a different C++ standard | 
					
						
							|  |  |  |     library (#{wrong.type_string} from #{wrong.compiler}). This could cause problems at runtime. | 
					
						
							| 
									
										
										
										
											2013-07-27 02:07:29 -07:00
										 |  |  |     EOS | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-09 13:44:59 -05:00
										 |  |  | class FormulaConflictError < Homebrew::InstallationError | 
					
						
							|  |  |  |   attr_reader :f, :conflicts | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize(f, conflicts) | 
					
						
							|  |  |  |     @f = f | 
					
						
							|  |  |  |     @conflicts = conflicts | 
					
						
							|  |  |  |     super f, message | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def conflict_message(conflict) | 
					
						
							|  |  |  |     message = [] | 
					
						
							|  |  |  |     message << "  #{conflict.name}" | 
					
						
							|  |  |  |     message << ": because #{conflict.reason}" if conflict.reason | 
					
						
							|  |  |  |     message.join | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message | 
					
						
							|  |  |  |     message = [] | 
					
						
							|  |  |  |     message << "Cannot install #{f.name} because conflicting formulae are installed.\n" | 
					
						
							|  |  |  |     message.concat conflicts.map { |c| conflict_message(c) } << "" | 
					
						
							|  |  |  |     message << <<-EOS.undent
 | 
					
						
							|  |  |  |       Please `brew unlink #{conflicts.map(&:name)*' '}` before continuing. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       Unlinking removes a formula's symlinks from #{HOMEBREW_PREFIX}. You can | 
					
						
							|  |  |  |       link the formula again after the install finishes. You can --force this | 
					
						
							|  |  |  |       install, but the build may fail or cause obscure side-effects in the | 
					
						
							|  |  |  |       resulting software. | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     message.join("\n") | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | class BuildError < Homebrew::InstallationError | 
					
						
							| 
									
										
										
										
											2013-02-17 22:52:39 -06:00
										 |  |  |   attr_reader :exit_status, :command, :env | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def initialize formula, cmd, args, es | 
					
						
							|  |  |  |     @command = cmd | 
					
						
							|  |  |  |     @env = ENV.to_hash | 
					
						
							|  |  |  |     @exit_status = es.exitstatus rescue 1
 | 
					
						
							| 
									
										
										
										
											2011-03-14 15:48:35 -07:00
										 |  |  |     args = args.map{ |arg| arg.to_s.gsub " ", "\\ " }.join(" ") | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |     super formula, "Failed executing: #{command} #{args}" | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def was_running_configure? | 
					
						
							|  |  |  |     @command == './configure' | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-03-07 11:11:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-31 11:26:45 -04:00
										 |  |  |   def issues | 
					
						
							| 
									
										
										
										
											2014-02-08 16:04:53 -05:00
										 |  |  |     @issues ||= fetch_issues | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def fetch_issues | 
					
						
							|  |  |  |     GitHub.issues_for_formula(formula.name) | 
					
						
							|  |  |  |   rescue GitHub::RateLimitExceededError => e | 
					
						
							|  |  |  |     opoo e.message | 
					
						
							|  |  |  |     [] | 
					
						
							| 
									
										
										
										
											2012-10-31 11:26:45 -04:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-07 11:11:05 +00:00
										 |  |  |   def dump | 
					
						
							| 
									
										
										
										
											2012-10-31 11:26:45 -04:00
										 |  |  |     if not ARGV.verbose? | 
					
						
							|  |  |  |       puts | 
					
						
							|  |  |  |       puts "#{Tty.red}READ THIS#{Tty.reset}: #{Tty.em}#{ISSUES_URL}#{Tty.reset}" | 
					
						
							| 
									
										
										
										
											2013-10-29 15:46:29 -04:00
										 |  |  |       if formula.tap? | 
					
						
							| 
									
										
										
										
											2013-11-11 18:09:02 +00:00
										 |  |  |         user, repo = formula.tap.split '/' | 
					
						
							|  |  |  |         tap_issues_url = "https://github.com/#{user}/homebrew-#{repo}/issues" | 
					
						
							| 
									
										
										
										
											2013-12-14 18:14:50 +00:00
										 |  |  |         puts "If reporting this issue please do so at (not Homebrew/homebrew):" | 
					
						
							| 
									
										
										
										
											2013-11-11 18:09:02 +00:00
										 |  |  |         puts "  #{tap_issues_url}" | 
					
						
							| 
									
										
										
										
											2013-10-29 15:46:29 -04:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-10-31 11:26:45 -04:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2012-09-27 15:39:16 -04:00
										 |  |  |       require 'cmd/--config' | 
					
						
							|  |  |  |       require 'cmd/--env' | 
					
						
							| 
									
										
										
										
											2013-06-23 16:15:11 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |       unless formula.core_formula? | 
					
						
							|  |  |  |         ohai "Formula" | 
					
						
							| 
									
										
										
										
											2013-06-23 16:21:48 -07:00
										 |  |  |         puts "Tap: #{formula.tap}" | 
					
						
							| 
									
										
										
										
											2013-06-23 16:15:11 -07:00
										 |  |  |         puts "Path: #{formula.path.realpath}" | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-09-27 15:39:16 -04:00
										 |  |  |       ohai "Configuration" | 
					
						
							|  |  |  |       Homebrew.dump_build_config | 
					
						
							|  |  |  |       ohai "ENV" | 
					
						
							|  |  |  |       Homebrew.dump_build_env(env) | 
					
						
							| 
									
										
										
										
											2012-10-31 11:26:45 -04:00
										 |  |  |       puts | 
					
						
							|  |  |  |       onoe "#{formula.name} did not build" | 
					
						
							| 
									
										
										
										
											2013-10-31 16:58:55 -07:00
										 |  |  |       unless (logs = Dir["#{HOMEBREW_LOGS}/#{formula}/*"]).empty? | 
					
						
							| 
									
										
										
										
											2013-10-27 17:17:09 +01:00
										 |  |  |         puts "Logs:" | 
					
						
							|  |  |  |         puts logs.map{|fn| "     #{fn}"}.join("\n") | 
					
						
							| 
									
										
										
										
											2012-10-31 11:26:45 -04:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-09-27 15:39:16 -04:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-08-13 09:50:15 -04:00
										 |  |  |     puts | 
					
						
							| 
									
										
										
										
											2014-03-17 11:52:11 -07:00
										 |  |  |     unless RUBY_VERSION < "1.8.7" || issues.empty? | 
					
						
							| 
									
										
										
										
											2012-10-31 11:26:45 -04:00
										 |  |  |       puts "These open issues may also help:" | 
					
						
							| 
									
										
										
										
											2014-01-20 17:46:33 -08:00
										 |  |  |       puts issues.map{ |i| "#{i['title']} (#{i['html_url']})" }.join("\n") | 
					
						
							| 
									
										
										
										
											2012-10-31 11:26:45 -04:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-03-07 11:11:05 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-05-20 19:35:07 -05:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # raised by CompilerSelector if the formula fails with all of | 
					
						
							|  |  |  | # the compilers available on the user's system | 
					
						
							| 
									
										
										
										
											2013-12-03 22:16:37 -06:00
										 |  |  | class CompilerSelectionError < Homebrew::InstallationError | 
					
						
							|  |  |  |   def initialize f | 
					
						
							|  |  |  |     super f, <<-EOS.undent
 | 
					
						
							|  |  |  |     #{f.name} cannot be built with any available compilers. | 
					
						
							| 
									
										
										
										
											2013-09-27 20:32:44 -07:00
										 |  |  |     To install this formula, you may need to: | 
					
						
							|  |  |  |       brew install apple-gcc42 | 
					
						
							|  |  |  |     EOS | 
					
						
							| 
									
										
										
										
											2013-05-20 19:35:07 -05:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | end | 
					
						
							| 
									
										
										
										
											2011-09-14 12:18:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-18 15:08:03 -05:00
										 |  |  | # Raised in Resource.fetch | 
					
						
							|  |  |  | class DownloadError < RuntimeError | 
					
						
							| 
									
										
										
										
											2014-02-18 15:08:03 -05:00
										 |  |  |   def initialize(resource, e) | 
					
						
							|  |  |  |     super <<-EOS.undent
 | 
					
						
							|  |  |  |       Failed to download resource #{resource.download_name.inspect} | 
					
						
							|  |  |  |       #{e.message} | 
					
						
							|  |  |  |       EOS | 
					
						
							| 
									
										
										
										
											2014-02-18 15:08:03 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-19 23:29:07 +01:00
										 |  |  | # raised in CurlDownloadStrategy.fetch | 
					
						
							| 
									
										
										
										
											2013-08-06 21:48:05 -07:00
										 |  |  | class CurlDownloadStrategyError < RuntimeError; end | 
					
						
							| 
									
										
										
										
											2011-09-14 12:18:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-19 23:29:07 +01:00
										 |  |  | # raised by safe_system in utils.rb | 
					
						
							| 
									
										
										
										
											2013-08-06 21:48:05 -07:00
										 |  |  | class ErrorDuringExecution < RuntimeError; end | 
					
						
							| 
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-17 11:31:53 -05:00
										 |  |  | # raised by Pathname#verify_checksum when "expected" is nil or empty | 
					
						
							| 
									
										
										
										
											2013-08-06 21:48:05 -07:00
										 |  |  | class ChecksumMissingError < ArgumentError; end | 
					
						
							| 
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | # raised by Pathname#verify_checksum when verification fails | 
					
						
							|  |  |  | class ChecksumMismatchError < RuntimeError | 
					
						
							| 
									
										
										
										
											2014-02-18 13:27:35 -05:00
										 |  |  |   attr_reader :expected, :hash_type | 
					
						
							| 
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-18 13:27:35 -05:00
										 |  |  |   def initialize fn, expected, actual | 
					
						
							| 
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 |  |  |     @expected = expected | 
					
						
							| 
									
										
										
										
											2012-06-26 00:51:02 -05:00
										 |  |  |     @hash_type = expected.hash_type.to_s.upcase | 
					
						
							| 
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     super <<-EOS.undent
 | 
					
						
							| 
									
										
										
										
											2012-06-26 00:51:02 -05:00
										 |  |  |       #{@hash_type} mismatch | 
					
						
							| 
									
										
										
										
											2014-02-18 13:27:35 -05:00
										 |  |  |       Expected: #{expected} | 
					
						
							|  |  |  |       Actual: #{actual} | 
					
						
							|  |  |  |       Archive: #{fn} | 
					
						
							|  |  |  |       To retry an incomplete download, remove the file above. | 
					
						
							| 
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 |  |  |       EOS | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2013-08-06 19:52:58 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | class ResourceMissingError < ArgumentError | 
					
						
							|  |  |  |   def initialize formula, resource | 
					
						
							|  |  |  |     @formula = formula | 
					
						
							|  |  |  |     @resource = resource | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def to_s | 
					
						
							|  |  |  |     "Formula #{@formula} does not define resource \"#{@resource}\"." | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DuplicateResourceError < ArgumentError | 
					
						
							|  |  |  |   def initialize resource | 
					
						
							|  |  |  |     @resource = resource | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def to_s | 
					
						
							|  |  |  |     "Resource \"#{@resource}\" defined more than once." | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |