title: Ruby's Exception Error classes
body: <p>You can create a subclass of an exception to make it more descriptive, but how should you set the default 'message'?</p>
  
  <pre><code>class MyError &lt; StandardError
    # default message = "You've triggered a MyError"
  end
  
  begin
    raise MyError, "A custom message"
  rescue Exception =&gt; e
    p e.message
  end
  
  begin
    raise MyError
  raise Exception =&gt; e
    p e.message
  end
  </code></pre>
  
  <p>The first should output 'A custom message'</p>
  
  <p>The second should output 'You've triggered a MyError'</p>
  
  <p>Any suggestions as to best practice?</p>