From the course: Spring with GraphQL

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Errors

Errors

- [Instructor] If you remember in the last video, I showed you a very ugly internal server error, when it actually was something that we were able to control. And I don't like internal errors if we actually can control the situation. So I want to show you how to modify the error output in a way that makes it more conducive to a production system. Just as a quick reminder, this was the internal error that we got when we tried to duplicate adding our entry. So what I want you to do is to open up source main Java and go to our controller and let's add another new class in here. And we are going to call this one HPlusEexceptionHandler. And this is going to extend the DataFetcherExceptionResolverAdapter. Let's go ahead and annotate this with @Component. And we are going to override a method. Now with GraphQL, you can return multiple errors and you'll see that we have a resolved multiple errors method that we can override.…

Contents