WEBVTT 00:00.460 --> 00:01.200 They'll come back. 00:01.200 --> 00:04.100 Now let us talk about raising an exception. 00:04.170 --> 00:10.940 I'm creating our own exception that this user defined exception to all user defined exception. 00:11.100 --> 00:17.340 You need to understand raising an exception every time we are not going to create our own except block. 00:17.400 --> 00:21.020 Maybe we want to just throw an exception at a random position. 00:21.150 --> 00:27.840 So I'm taking an example in which I have created a class and then I'm creating and then I'm creating 00:27.840 --> 00:33.030 an object passing its value and calling a method with the help of that object. 00:33.420 --> 00:39.520 So all I'm doing is I'm taking them creature off my tree and then checking with the condition that if 00:39.660 --> 00:42.900 it's greater than 85 then it's too hard. 00:42.990 --> 00:45.830 Less than 65 that's too good. 00:46.020 --> 00:50.980 And if it's between them then it's OK to drink with this for the commission. 00:51.000 --> 00:58.840 Maybe if it's greater than 85 I want to raise an error or exception hell maybe with less than 65. 00:58.860 --> 01:06.090 I want to raise an exception here so that I can use a keyword called Drees and I can actually raise 01:06.180 --> 01:07.760 an exception here. 01:07.890 --> 01:11.190 So if I run this particular program for now. 01:11.250 --> 01:18.730 So with this temperature I'm going into this condition and it's sprinting to ring with the sort of the 01:18.760 --> 01:22.270 condition you're ok to read. 01:22.530 --> 01:28.740 Now I want to raise an exception here whenever the temperature of my D goes about 85. 01:28.980 --> 01:35.070 So all I have to do is use up you don't freeze and then I need to find the exception. 01:35.190 --> 01:38.360 So if we have a user defined exception I can use that. 01:38.480 --> 01:41.970 But at this point of time I will be using my base class. 01:41.970 --> 01:43.970 Also let me change it above. 01:44.060 --> 01:49.840 It defines Cygan satisfy that condition and then raise an exception. 01:50.070 --> 01:56.340 So you can see this is an exception created by me because I have raised an exception and this is not 01:56.340 --> 01:58.110 an exception because of a program. 01:58.110 --> 02:01.380 This is an exception because I raised red herring. 02:01.370 --> 02:07.360 I tried to print something as you can see now I'm not getting any exception. 02:07.590 --> 02:11.090 So this means I can raise an exception whenever I want. 02:11.160 --> 02:15.470 So I can create my own condition maybe if I'm walking with a bank project. 02:15.500 --> 02:21.460 And if the balance is less than 10000 then I can raise an exception that balances low. 02:21.600 --> 02:28.780 So I can create my own exception about low balance and I can raise that exception so that we can raise 02:28.780 --> 02:30.980 our one exception and we can call them. 02:31.200 --> 02:33.380 So let me pass some value here. 02:34.600 --> 02:40.320 And if I had on this one you didn't have an exception with the message that the two are. 02:40.690 --> 02:47.050 So that's how we can raise exception and we can raise different different bible exception a different 02:47.050 --> 02:47.800 condition. 02:47.920 --> 02:56.410 Also here I'm using my Because I can use my glasses also like 0 division or type or attribute whatever 02:56.410 --> 02:57.120 I want. 02:57.220 --> 03:02.800 I can also try to draw a value and that would be much better here in this case. 03:03.220 --> 03:10.810 Let me run this one again begin to see I'm not getting value at all on my D is too hard. 03:11.010 --> 03:16.740 So you can live in these type of exception and at a certain level you get a certain condition. 03:16.830 --> 03:22.920 You get these different type of exception where I can just raise my exception that the is to call. 03:23.130 --> 03:28.230 So that's how you can define different bible cases and different type of exception. 03:28.230 --> 03:30.460 Now the second thing that I was talking about. 03:30.640 --> 03:35.720 To create user defined exception so that we'll be doing and next election. 03:35.730 --> 03:41.430 So now I hope you understand about raising an exception and in the next election talk about creating 03:41.430 --> 03:47.700 our own exception and then passing out one exception instead of begin building exceptions. 03:47.700 --> 03:49.500 So see you in the next one.