class ViewModel::DeserializationError::DatabaseConstraint
Attributes
detail[R]
Public Class Methods
from_exception(exception, nodes = [])
click to toggle source
Database constraint errors are pretty opaque and stringly typed. We can do our best to parse out what metadata we can from the error, and fall back when we can't.
# File lib/view_model/deserialization_error.rb, line 348 def self.from_exception(exception, nodes = []) case exception.cause when PG::UniqueViolation UniqueViolation.from_postgres_error(exception.cause, nodes) else self.new(exception.message, nodes) end end
new(detail, nodes = [])
click to toggle source
Calls superclass method
ViewModel::AbstractErrorWithBlame::new
# File lib/view_model/deserialization_error.rb, line 340 def initialize(detail, nodes = []) @detail = detail super(nodes) end