Skip to content

Ignore errors for optional attributes #227

@wilkerlucio

Description

@wilkerlucio

Currently, when an attribute is requested as optional and there is no return, Pathom will return the rest of the data. The same isn't true when that optional requirement path triggers an exception. Example case:

(pco/defresolver error-attr []
  {:error (throw (ex-info "Error" {}))})

(def env
  (-> {}
      (pci/register [error-attr])))

(p.eql/process env [(pco/? :error)])

This should change, and Pathom should ignore exceptions related to optional attributes. It should also be aware if the error happened while computing a dependency for some optional attribute. For example:

(pco/defresolver error-attr []
  {:error (throw (ex-info "Error" {}))})

(def env
  (-> {}
      (pci/register
        [error-attr
         (pbir/alias-resolver :error :error-dep)])))

(p.eql/process env [(pco/? :error-dep)])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions