All right.
And while we're still at it, why don't we also take a look how we can check for a duplicate e-mail
right here?
Ian Rogers the controller because it might come in handy from time to time and effectively what we're
trying to do is not to rely on the error handler to do the job.
Instead, we want to right away send back the response from the controller.
And the way it's going to look like we're going to go here with email and we're going to go with John
at Gmail dot com.
I do need to make sure that I have all the proper syntax here and Senate, and we're clearly know that
this is coming from our error handler.
And the alternative approach that we can take is something like this where I could come up with some
kind of property name.
So contact and in my case, I'm going to go with user already exists and that will be equal to await.
And now I want to go with the user and then find one.
And inside of the filter object, I want to pass in the email, which essentially is going to look for
a user with a less specific email.
So if email is provided, then let's check for the user.
Now, if user already exists, if that is the case, what we can do?
Well, we can throw you by request.
There are certain throw new bat requests.
And what do we want a person?
Well, some kind of alternative message, meaning different message.
That's what we have in our handler otherwise.
I mean, it's going to be very hard to see where the error is coming from.
So I'm going to go with email.
Already in use, let's service, and now it's just around what Senate and now we have 400.
And the message is following email already.
And we are know that this is coming from our own error handler.