1
00:00:00,210 --> 00:00:00,570
All right.

2
00:00:00,600 --> 00:00:07,350
And while we're still at it, why don't we also take a look how we can check for a duplicate e-mail

3
00:00:08,130 --> 00:00:09,000
right here?

4
00:00:09,330 --> 00:00:15,810
Ian Rogers the controller because it might come in handy from time to time and effectively what we're

5
00:00:15,810 --> 00:00:21,720
trying to do is not to rely on the error handler to do the job.

6
00:00:22,140 --> 00:00:26,070
Instead, we want to right away send back the response from the controller.

7
00:00:26,550 --> 00:00:32,520
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

8
00:00:33,270 --> 00:00:34,770
at Gmail dot com.

9
00:00:34,770 --> 00:00:41,670
I do need to make sure that I have all the proper syntax here and Senate, and we're clearly know that

10
00:00:41,670 --> 00:00:43,830
this is coming from our error handler.

11
00:00:44,220 --> 00:00:49,830
And the alternative approach that we can take is something like this where I could come up with some

12
00:00:49,830 --> 00:00:50,790
kind of property name.

13
00:00:51,030 --> 00:00:59,310
So contact and in my case, I'm going to go with user already exists and that will be equal to await.

14
00:00:59,700 --> 00:01:02,910
And now I want to go with the user and then find one.

15
00:01:03,180 --> 00:01:09,250
And inside of the filter object, I want to pass in the email, which essentially is going to look for

16
00:01:09,250 --> 00:01:11,760
a user with a less specific email.

17
00:01:12,000 --> 00:01:16,260
So if email is provided, then let's check for the user.

18
00:01:16,620 --> 00:01:21,750
Now, if user already exists, if that is the case, what we can do?

19
00:01:22,080 --> 00:01:24,210
Well, we can throw you by request.

20
00:01:24,210 --> 00:01:28,560
There are certain throw new bat requests.

21
00:01:29,220 --> 00:01:30,470
And what do we want a person?

22
00:01:30,480 --> 00:01:34,920
Well, some kind of alternative message, meaning different message.

23
00:01:34,920 --> 00:01:36,840
That's what we have in our handler otherwise.

24
00:01:37,200 --> 00:01:40,680
I mean, it's going to be very hard to see where the error is coming from.

25
00:01:40,920 --> 00:01:41,970
So I'm going to go with email.

26
00:01:42,860 --> 00:01:51,170
Already in use, let's service, and now it's just around what Senate and now we have 400.

27
00:01:51,560 --> 00:01:54,380
And the message is following email already.

28
00:01:55,160 --> 00:01:59,750
And we are know that this is coming from our own error handler.

