• Yorick Peterse's avatar
    Handle errors without causes · 36dd486c
    Yorick Peterse authored
    The method `LoadBalancer#connection_error?` would unwrap errors that
    inherit from ActiveRecord::StatementInvalid and
    ActionView::Template::Error, in an attempt to see if any connection
    errors were wrapped. When given an error without a cause, such as
    ActiveRecord::RecordNotUnique, it would fail, as `cause` on the error
    returns `nil`. This in turn would manifest in various tests, such as
    those for the `ApplicationRecord` model.
    
    This commit fixes these issues by just returning `false` when there is
    no error cause.
    
    Changelog: fixed
    36dd486c
load_balancer_spec.rb 11 KB