1 00:00:00,560 --> 00:00:08,210 Now, at this stage, when you take on the stand and try to create an account, no matter what errors 2 00:00:08,600 --> 00:00:15,380 it will just say failed to create yuzu, this is because somebody mishandled the area, because Santa 3 00:00:15,380 --> 00:00:17,090 failed to create yuzu. 4 00:00:17,270 --> 00:00:25,910 We do not have any validation on each field of the user, so the user will not know why they cannot 5 00:00:25,910 --> 00:00:26,880 create the account. 6 00:00:27,200 --> 00:00:33,470 So now we are going to create a custom error message, for example, for the name since this is required. 7 00:00:33,590 --> 00:00:40,910 We are going to create a custom message that please send her a name and for the email we are going to 8 00:00:40,910 --> 00:00:44,900 type, please send her a email. 9 00:00:45,080 --> 00:00:52,160 And for the unique, we do not need to type anything because it will automatically check for the email 10 00:00:52,160 --> 00:00:52,550 address. 11 00:00:53,110 --> 00:00:55,370 OK, so let me try it for you. 12 00:00:55,640 --> 00:01:02,750 Even though we typed some error here, you will not display the error message and then we go to the 13 00:01:02,750 --> 00:01:03,470 password. 14 00:01:05,110 --> 00:01:17,560 And we type please enter a password, and for the minimum length we type, the password should be at 15 00:01:17,560 --> 00:01:20,290 least six alone alone. 16 00:01:20,860 --> 00:01:26,200 So we also want to check whether this is a redit email. 17 00:01:26,500 --> 00:01:35,620 And we can use this package with data because it already has an effort to check whether this is a email 18 00:01:35,770 --> 00:01:38,530 and it will return, true or false. 19 00:01:39,220 --> 00:01:49,210 And it has also other type of validation, such as is it a BTC address or is it a credit card so we 20 00:01:49,210 --> 00:01:57,250 can go to the portrait and stop the server and then we type NPM install to where the data. 21 00:01:58,860 --> 00:02:10,250 And then we go to the top and angre cornerstone is email equal, require better data, and then we type 22 00:02:10,260 --> 00:02:12,900 with a date and it will track. 23 00:02:12,900 --> 00:02:20,580 If email is false, we will type Creuse into a valid email address. 24 00:02:22,800 --> 00:02:27,810 So if this is an email, you will just like the other, it will return to true. 25 00:02:28,230 --> 00:02:36,090 So now we back to the old controller and we go to the side up functions and then inside the error they 26 00:02:36,090 --> 00:02:39,350 are error message and also error code. 27 00:02:39,510 --> 00:02:47,340 So we don't load these two things so we can try to start the server. 28 00:02:48,450 --> 00:02:51,170 And then this is the account that we already created. 29 00:02:51,180 --> 00:02:54,390 And if we try to send this account. 30 00:02:56,020 --> 00:03:01,750 And you can see it has the error message and this has that duplicate key error correction. 31 00:03:01,780 --> 00:03:06,770 So this is not the same as the error message that we just created. 32 00:03:07,180 --> 00:03:11,770 So this is useless to get their custom message here. 33 00:03:12,130 --> 00:03:13,930 But we can see there is an error. 34 00:03:14,240 --> 00:03:19,160 So later it will depends on this error and we create and custom methods. 35 00:03:19,870 --> 00:03:22,660 So now we try to delete Gmail. 36 00:03:22,690 --> 00:03:28,300 So this is not a relevant email and we also delete some character. 37 00:03:28,330 --> 00:03:30,430 So this is not fulfilled. 38 00:03:30,610 --> 00:03:32,380 At least six Karatas long. 39 00:03:32,900 --> 00:03:39,070 And then we send this to the server and now we will back to the server and you will see there are two 40 00:03:39,280 --> 00:03:40,180 error message. 41 00:03:41,140 --> 00:03:48,490 One is for the e-mail peace and a relet email address, and this is what we typed here, and for the 42 00:03:48,490 --> 00:03:51,850 password, the password should be a Cavitat launch. 43 00:03:52,060 --> 00:03:56,050 And for this area, the error is undefined. 44 00:03:56,140 --> 00:04:03,010 So in the off controller, instead of handling all the errors here, we are going to create and other 45 00:04:03,010 --> 00:04:05,470 functions to handle this error.