lib/rest_model/serialization/date.rb in rest_model-0.1.6 vs lib/rest_model/serialization/date.rb in rest_model-0.1.7
- old
+ new
@@ -2,18 +2,18 @@
module Serialization
class Date
def self.serialize(value)
::Date.parse value
rescue ArgumentError
- raise "value not serializable: #{value}"
+ raise SerializationError, "value '#{value}' is an invalid date"
end
def self.desserialize(value)
date = value.kind_of?(::Date) ? value : ::Date.parse(value)
format = RestModel::Configuration.date_format
format ? date.strftime(format) : date.to_s
rescue ArgumentError
- raise "value not desserializable: #{value}"
+ raise SerializationError, "value '#{value}' is an invalid date"
end
end
end
end