From the course: Spring with GraphQL
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Errors - Spring Tutorial
From the course: Spring with GraphQL
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.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Setting up the project4m 18s
-
(Locked)
Creating the schema4m 5s
-
(Locked)
Creating a Spring Data repository5m 41s
-
(Locked)
Creating the GraphQL controller6m 44s
-
(Locked)
Mutations5m 32s
-
(Locked)
Errors4m 8s
-
(Locked)
Challenge: Extending the API1m 19s
-
(Locked)
Solution: Extending the API4m 4s
-
(Locked)
-