Fork me on GitHub
#graphql
<
2017-10-04
>
guy15:10:04

Hey all sorry for another newbie question. I've just been reading about errrors and how you are supposed to use resolve-as. http://lacinia.readthedocs.io/en/latest/resolve/resolve-as.html To me it sounds like you would wrap your resolver function with a try catch, then in the catch call

(resolve-as resolved-value {:message "something when wrong"})

guy15:10:01

am i along the right track?

hlship16:10:53

Yes, that's that's pretty much exactly how it goes. Earlier versions of Lacinia would catch exceptions inside field resolver functions for you, but that turned out to be unnecessary overhead most of the time, and got in the way of actually debugging real problems. Please feel free to suggest improvements to the documentation, if this was not clear.

guy16:10:01

:thumbsup:

guy16:10:06

thanks a bunch

guy16:10:21

Yeah i'm just using it in my new project

guy16:10:32

I'll see if i can do a write up afterwards or something