Exception to the Rule

Getting error handling right for my linker verification process.

Key Points:

  • rescue Exception is too broad, recsue StandardError is better
  • No need to distinguish errors at this point so rescue StandardError is sufficient to cover all… Standard Errors
  • No need to actually specify standardError as it is the default
  • So with a bit of Less is More, YAGNI and convention over configuration I end up with just:

    def valid_get?
    HTTParty.get(url_address).code.between?(200,399) ? true : false