Guru on Rails

if you don’t sacrifice for your dream then your dream becomes your sacrifice.
Sydney, Sat 01 Jun 2019
Exceptions
Fri 17 Aug 2018

When we were Junior developer we didn't actually notice so much about exceptions in ruby. That is because we didn't develop library to contribute the community yet. If we used to create libraries or even using them, we see that every time an issue occurs, an exception is thrown and we know exactly what kind of issue we are encountering. We might not know exactly but at least it provides clue for tracking issue.

def wrap(value)
   case value
   when Sablon::Content
      value
   else
      if type = type_wrapping(value)
         type.new(value)
      else
         raise ArgumentError, "Could not find Sablon content type to wrap #{value.inspect}"
      end
   end
end

(Sablon gem)

to be continue