Read more

Defining custom errors in Ruby

Dominik Schöler
September 09, 2011Software engineer at makandra GmbH
class Errormaster
  CoffeeIsOut = Class.new(StandardError)
  
  # is prettier than
  class CoffeeIsOut < StandardError; end
end

Reference such an error class with Errormaster::CoffeeIsOut.

Illustration book lover

Growing Rails Applications in Practice

Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.

  • Introduce design conventions for controllers and user-facing models
  • Create a system for growth
  • Build applications to last
Read more Show archive.org snapshot
Posted by Dominik Schöler to makandra dev (2011-09-09 14:39)