Skip to content

Commit 9a81c8e

Browse files
committed
add cause property to graphql error logs
1 parent df525b0 commit 9a81c8e

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/GraphQL/Client/Query.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function cause(err) {
2+
return String(err.cause || "");
3+
}

src/GraphQL/Client/Query.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ import GraphQL.Client.Types (class GqlQuery, class QueryClient, Client(..), GqlR
4343
import GraphQL.Client.Variables (class VarsTypeChecked, getVarsJson, getVarsTypeNames)
4444
import Type.Proxy (Proxy(..))
4545

46+
foreign import cause :: Error -> String
47+
4648
-- | Run a graphQL query with a custom decoder and custom options
4749
queryOptsWithDecoder
4850
:: forall client directives schema query returns queryOpts mutationOpts sr
@@ -261,6 +263,8 @@ addErrorInfo schema queryName q =
261263
<> show queryName
262264
<> ".\nerror: "
263265
<> message err
266+
<> ".\ncause: "
267+
<> cause err
264268
<> ".\nquery: "
265269
<> queryName
266270
<> " "

0 commit comments

Comments
 (0)