Neat. How does this scale? Schema stitching and having a single, unified, data graph is becoming the de facto best practice nowadays. Conceptually this approach have some parallels with the exception hell problem in large Java codebases.
Brings error handling to this logic level is not a good option. In this case I need to check for an error within `onSuccess` callback, for example with `react-query`, but I just need to get all errors with `onError` callback. And if you need distinguish one error from another just use `code` field in error object, with values e.g. BAD_REQUEST, NOT_FOUND, USER_BLOCKED etc.
I'm not really sure that we can say that errors are things that we didn't expect, I'd say that's more like the exceptions (like we'd see in a 500). The errors like a record not found, or a validation error, should be considered as expected states. It so happens that we tend to call these errors, which maybe gives the wrong message, but in a strange way, it's still kinda the best fit. If the front end doesn't know what to do with it and it's available in the schema as a known possible response, then they need to improve their dev process :)
Really important topic that isn't often discussed. Nice use of unions, too!
Love it! Thank you for the clear explanation.
Neat. How does this scale? Schema stitching and having a single, unified, data graph is becoming the de facto best practice nowadays. Conceptually this approach have some parallels with the exception hell problem in large Java codebases.
And a follow up question: I guess the approach for error handling in mutations is the same?
Brings error handling to this logic level is not a good option. In this case I need to check for an error within `onSuccess` callback, for example with `react-query`, but I just need to get all errors with `onError` callback. And if you need distinguish one error from another just use `code` field in error object, with values e.g. BAD_REQUEST, NOT_FOUND, USER_BLOCKED etc.
Union types, great!
I'm not really sure that we can say that errors are things that we didn't expect, I'd say that's more like the exceptions (like we'd see in a 500). The errors like a record not found, or a validation error, should be considered as expected states. It so happens that we tend to call these errors, which maybe gives the wrong message, but in a strange way, it's still kinda the best fit. If the front end doesn't know what to do with it and it's available in the schema as a known possible response, then they need to improve their dev process :)
Nice talk, thanks
I've been watching a lot of her lately, idk why...
Cause she is Wonderfull Girl, is'nt she ?
wow