From: Joe Van Dyk Date: 2005-08-31T03:00:31+09:00 Subject: Re: custom exceptions On 8/30/05, Joe Van Dyk wrote: > Hi, > > When should you define your own exceptions? Any rules of thumb? > > I'm writing an application that runs on a computer and listens for > requests to start, kill, and view log files for other applications on > that computer. Say I get a request to start an application on that > computer and the requested executable doesn't exist. Should I throw a > custom exception then? Or, say an application dies unexpectedly. > What should I use for an exception then? The start function follows: class Application ... def start raise "No executable given!" if not @executable if @pid = fork Process.detach @pid @status = :running else @options.each do |option_name, option_value| ENV[option_name] = option_value end args = @arguments.join " " exec "#{ basedir }/#{ version }/#{ executable } #{ args }" end end ... end So, if there's no valid executable, then the exec call will fail. What's the best way of transmitting that information to the rest of the system?