lib/restly/error.rb in restly-0.0.1.alpha.1 vs lib/restly/error.rb in restly-0.0.1.alpha.2

- old
+ new

@@ -1,30 +1,28 @@ module Restly::Error - class NotAnRestly < StandardError - end + class StandardError < ::StandardError - class RecordNotFound < StandardError - end + def message + super.red + end - class WrongResourceType < StandardError end - class InvalidParentAssociation < StandardError - end + errors = %w{ + RecordNotFound + WrongResourceType + InvalidParentAssociation + InvalidJoinerAssociation + InvalidObject + InvalidToken + InvalidConnection + MissingId + InvalidSpec + AssociationError + } - class InvalidJoinerAssociation < StandardError - end - - class InvalidObject < StandardError - end - - class InvalidToken < StandardError - end - - class InvalidConnection < StandardError - end - - class InvalidSpec < StandardError + errors.each do |error| + const_set(error.to_sym, Class.new(StandardError)) end end \ No newline at end of file