Skip to content

Instantly share code, notes, and snippets.

@matheusfrancisco
Last active February 17, 2021 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheusfrancisco/09de37256dd94d8935e4d3be64adf7c9 to your computer and use it in GitHub Desktop.
Save matheusfrancisco/09de37256dd94d8935e4d3be64adf7c9 to your computer and use it in GitHub Desktop.
pathom.clj
(ns buzzlabs.scraper.actions
(:require
[com.wsscode.pathom3.connect.built-in.resolvers :as pbir]
[com.wsscode.pathom3.interface.eql :as p.eql]
[com.wsscode.pathom3.interface.async.eql :as pa.eql]
[com.wsscode.pathom3.connect.indexes :as pci]
[com.wsscode.pathom3.connect.operation :as pco]
[com.wsscode.pathom3.interface.smart-map :as psm]
[com.wsscode.pathom3.connect.built-in.resolvers :as pbir]
[clj-http.cookies :as cookies]
[clj-http.client :as http]
[clojure.data.json :as json]
[taoensso.timbre :refer [info]]
[net.cgrand.enlive-html :as html]
[clojure.string :as st]
[clojure.tools.reader.edn :as edn]
;[promesa.core :as p]
[taoensso.timbre :as log]
[clojure.pprint :as pp]))
;; what happening?
(pco/defresolver ex11 []
{::pco/output [:ex.xico/http]}
{:ex.xico/http (http/post "https://httpbin.org/post" {:headers {:Content-Type "application/json"}})})
(pco/defresolver ex12 []
{::pco/input [:ex.xico/c]}
{:ex.xico/cc (http/post "https://url1.org/post" {:headers {:Content-Type "application/json"}})})
(pco/defmutation mutation-ex3 []
{:ex.xico/cc (http/post "https://url2.org/post" {:headers {:Content-Type "application/json"}})})
(def env1 (->
(pci/register
[ex11
ex12
mutation-ex3])
(psm/with-error-mode ::psm/error-mode-loud)))
;; note in line 41 with psm/with-error-mode if I comment #_(psm/...) this line, the mutation will be work.
;; with this line(41) uncommented the invoke at line 47 return an error, I put in first comment bellow
(:ex.xico/http (psm/smart-map env1))
(p.eql/process env1 [`(mutation-ex3)])
@matheusfrancisco
Copy link
Author

matheusfrancisco commented Feb 17, 2021

       :data #:com.wsscode.pathom3.attribute{:attribute :async},
       :via [{:type clojure.lang.ExceptionInfo,
              :message "Can't find a path for :async",
              :data #:com.wsscode.pathom3.attribute{:attribute :async},
              :at [com.wsscode.pathom3.connect.runner.stats$attribute_error__25438 invokeStatic "stats.cljc" 73]}],
       :trace [[com.wsscode.pathom3.connect.runner.stats$attribute_error__25438 invokeStatic "stats.cljc" 73]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment