1
00:00:00,330 --> 00:00:07,470
And as far as the cast error, of course, in the Arth, we're not going to get it because we're not

2
00:00:07,470 --> 00:00:11,090
using GADIS, but in the jobs, we should get it.

3
00:00:11,550 --> 00:00:18,690
So back in where I have the jobs controller, if we take a look at, I don't know, get a single job.

4
00:00:19,080 --> 00:00:22,710
Of course, I'm passing in the job idea that is coming from programs.

5
00:00:22,950 --> 00:00:23,370
Correct.

6
00:00:23,700 --> 00:00:32,299
And here, if I cannot find a job that has the job with usery, of course I send back the not founder

7
00:00:32,580 --> 00:00:38,910
or however, there also might be a case where the syntax doesn't match to whatever the database is looking

8
00:00:38,910 --> 00:00:39,190
for.

9
00:00:39,540 --> 00:00:43,640
And of course, in order to showcase that, let me just go to get all the jobs.

10
00:00:43,890 --> 00:00:47,610
So this is going to get me all the jobs that Susan has.

11
00:00:47,850 --> 00:00:51,150
And as a side note, I think I logged out.

12
00:00:51,340 --> 00:00:56,160
So let me log in back as Susan so say or here password.

13
00:00:57,040 --> 00:01:03,490
And in my case, while I'm testing, I'm pretty much setting everything up as a secret, so it's it

14
00:01:03,490 --> 00:01:03,800
here?

15
00:01:03,820 --> 00:01:05,550
Yep, we have the tokens.

16
00:01:05,550 --> 00:01:07,990
So let me now send get all jobs.

17
00:01:08,230 --> 00:01:08,680
Awesome.

18
00:01:09,010 --> 00:01:10,120
I'm getting the jobs.

19
00:01:10,360 --> 00:01:15,160
And now, of course, whether that's for get a single job up there, job or daily job, I will have

20
00:01:15,160 --> 00:01:16,060
to provide that.

21
00:01:16,690 --> 00:01:19,210
And if I'll just mess up the values, that's one thing.

22
00:01:19,500 --> 00:01:21,250
Then we'll get that four or four.

23
00:01:21,640 --> 00:01:24,190
But we also might have that cast error.

24
00:01:24,670 --> 00:01:30,040
So let's go to, I don't know, get a single job copy and paste the correct.

25
00:01:30,040 --> 00:01:30,910
Any sound here.

26
00:01:30,910 --> 00:01:34,180
OK, we should get back the correct response.

27
00:01:34,480 --> 00:01:40,710
But if I'm going to start adding the values or removing, we should see the casting error.

28
00:01:40,870 --> 00:01:43,590
Now, again, in our case, we just see the string.

29
00:01:44,110 --> 00:01:45,640
So let me scroll down.

30
00:01:45,640 --> 00:01:50,950
I know a little bit annoying, but it's important for me to showcase those big objects just so I can

31
00:01:50,950 --> 00:01:52,570
see where we're getting the values from.

32
00:01:52,960 --> 00:01:55,930
And once I send it, of course, now I have error.

33
00:01:56,120 --> 00:01:58,750
The name is equal to cast error.

34
00:01:58,900 --> 00:02:05,110
And I just want to swing back to our error handler and essentially set up the if condition where I'm

35
00:02:05,110 --> 00:02:07,480
going to be checking for cast error.

36
00:02:07,510 --> 00:02:12,760
If that is the case, then of course I'll just send back some kind of string with four or four.

37
00:02:13,060 --> 00:02:19,180
So again, that's going to be not found one and I'll just provide the value just so user can understand

38
00:02:19,390 --> 00:02:20,170
what's happening.

39
00:02:20,440 --> 00:02:21,700
So let's go back over here.

40
00:02:21,700 --> 00:02:30,310
Let's say if and I'll just say our name and if it is equal to a cast error and if that is the case,

41
00:02:30,550 --> 00:02:34,720
I want to go with my custom error, then the proper name is message.

42
00:02:34,990 --> 00:02:38,050
And actually I want to set it up as a template structure.

43
00:02:38,050 --> 00:02:43,780
No item found with ID and then we're going to be going for error.

44
00:02:44,080 --> 00:02:46,510
And of course, I'm looking for the value one.

45
00:02:47,050 --> 00:02:51,560
So in the error object, there's a valid property and I'm looking for society.

46
00:02:52,030 --> 00:02:54,460
So it's error value.

47
00:02:54,940 --> 00:02:57,490
And then the next thing is that that is code.

48
00:02:57,730 --> 00:03:03,610
And in this case, we want to go with custom, our custom error here status code.

49
00:03:03,790 --> 00:03:07,750
And that is going to be equal to, for or for or not found.

50
00:03:07,960 --> 00:03:13,420
Now, of course, if you want to use the status codes here as well, please definitely do.

51
00:03:13,420 --> 00:03:20,050
So I just thought that it's important for me to first time show you the actual number status code and

52
00:03:20,050 --> 00:03:24,190
that if you want, you can use the library instead of me, send it here.

53
00:03:24,490 --> 00:03:27,340
And of course I should get back the proper response.

54
00:03:27,340 --> 00:03:30,720
But the problem is that I'm still sending back the first one.

55
00:03:31,030 --> 00:03:32,380
So now let me remove it.

56
00:03:32,560 --> 00:03:35,170
Since we're not going to use it, let's save it.

57
00:03:35,410 --> 00:03:41,110
And then once we send that, we have no item found with Adi and we have the four or four.

58
00:03:41,440 --> 00:03:45,280
And with this in place, of course, we can move on to the next topic.

