lib/scrivito/date_attribute.rb in scrivito_sdk-1.0.0 vs lib/scrivito/date_attribute.rb in scrivito_sdk-1.1.0.rc1
- old
+ new
@@ -15,10 +15,13 @@
def self.deserialize_from_client(iso8601_date_time)
return unless iso8601_date_time
DateTime.iso8601(iso8601_date_time).in_time_zone
rescue ArgumentError
- raise "The value is not a valid ISO 8601 date time: #{iso8601_date_time.inspect}"
+ raise Scrivito::ClientError.new(
+ "The value is not a valid ISO 8601 date time: #{iso8601_date_time.inspect}",
+ 400
+ )
end
def self.serialize_for_backend(attribute_value)
attribute_value = case attribute_value
when Date then attribute_value.to_time