solid-primitives
solid-primitives copied to clipboard
@solid-primitives/graphql error throw format
Describe the bug
This "bug" may belong into solid-js since the problem itself relays on a function on that package, however I'll post what I found:
When an error occurs in a graphql query, the returning error throws:
Which itself doesn't say much about what could be happening, This particular throw occurred when I passed a wrong query variables, this should return (and has) the error that the server returns. I debug a bit this error to get more information:
I found that this was the function that was throwing the error, so I tried to get something from err
before it returned:
So the error is there is just not being displayed, for what the code shows, anything that is not a string will be thrown as "Unknown Error", so my suggestion would be maybe throwing the original error before it goes to "castError" or, a simpler solution and even (a bit dirtier) could be just concatenating all the messages in the array and then throwing the messages, I think with that I can work to try to solve bugs on my end.
I don't think any of my packages is interfering in this case, I was able to replicate this behavior in Stackblizts with only solid-js and @solid-primitives/graphql
package.json
"devDependencies": {
"@tailwindcss/typography": "^0.5.9",
"autoprefixer": "^10.4.14",
"daisyui": "^3.1.6",
"eslint": "^8.43.0",
"eslint-plugin-solid": "^0.12.1",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"vite": "^4.3.9",
"vite-plugin-solid": "^2.7.0"
},
"dependencies": {
"@solid-primitives/graphql": "^2.0.1",
"@solid-primitives/storage": "^2.0.0",
"@thisbeyond/solid-select": "^0.14.0",
"graphql": "^16.7.1",
"jose": "^4.14.4",
"solid-js": "^1.7.6",
"universal-cookie": "^4.0.4"
}
Minimal Reproduction Link
https://stackblitz.com/edit/github-3drhwq?file=src%2FApp.tsx