1 00:00:01,540 --> 00:00:07,090 It's nice when things go right when someone searches for a location and we're able to find a match or 2 00:00:07,090 --> 00:00:12,490 when someone asks for the weather very set of coordinates and we're able to get and display the forecast 3 00:00:12,690 --> 00:00:12,930 now. 4 00:00:12,970 --> 00:00:16,240 We always hope that things go right but that's not always the case. 5 00:00:16,240 --> 00:00:21,790 There are plenty of things that could go wrong with our HDTV requests and in this video we're going 6 00:00:21,790 --> 00:00:27,730 to focus on handling those potential errors giving the user a better experience when things don't go 7 00:00:27,850 --> 00:00:28,750 as expected. 8 00:00:28,810 --> 00:00:32,890 Together we'll set up error handling for the weather API request. 9 00:00:32,920 --> 00:00:38,710 Then as your challenge for the video you'll be setting up error handling for our geo coding request. 10 00:00:38,800 --> 00:00:44,380 For the moment I'm going to comment out all of the geo coding related information down below. 11 00:00:44,380 --> 00:00:49,280 By using Command Forward slash which would be control forward slash on windows. 12 00:00:49,390 --> 00:00:55,510 When I have all of those lines selected and we're going to focus on what we have up above just the weather 13 00:00:55,570 --> 00:00:56,870 request now. 14 00:00:56,890 --> 00:01:03,820 One really obvious way things can go wrong when making an HDTV network request is if there is no network 15 00:01:03,850 --> 00:01:04,690 available. 16 00:01:04,690 --> 00:01:06,390 If you're not connected to the Internet. 17 00:01:06,400 --> 00:01:08,780 This is indeed going to fail. 18 00:01:08,800 --> 00:01:11,680 Let's go ahead and see this in action up above. 19 00:01:11,710 --> 00:01:18,150 I'm going to temporarily turn off my Wi-Fi and we're going to do is run our script. 20 00:01:18,150 --> 00:01:23,000 So from the terminal node space app dot J s when I do this what do I get. 21 00:01:23,010 --> 00:01:30,780 I get a really long error message and the actual error says cannot read property body of undefined. 22 00:01:31,110 --> 00:01:38,100 So in this case when things go wrong and there is no network request the error argument contains a value 23 00:01:38,310 --> 00:01:40,320 and response does not. 24 00:01:40,320 --> 00:01:45,360 So we have to go ahead and add a little bit of conditional logic making sure we're checking that there 25 00:01:45,360 --> 00:01:49,550 is no error before we try to interact with the response. 26 00:01:49,560 --> 00:01:53,370 Right now it's trying to read body of undefined right here. 27 00:01:53,370 --> 00:01:57,620 Response is indeed undefined and that's what's causing the problem. 28 00:01:57,630 --> 00:02:01,980 Now once again we can't fix the lack of network connectivity. 29 00:02:01,980 --> 00:02:05,210 That's not the job of error handling in our case. 30 00:02:05,250 --> 00:02:07,820 The goal is to do something a bit better than this. 31 00:02:07,830 --> 00:02:15,630 Tell them in a regular human readable way that they currently don't have access to the weather API so 32 00:02:15,630 --> 00:02:20,460 to get that done we're going to add an if statement right inside of our function before we do. 33 00:02:20,490 --> 00:02:22,670 Let's go ahead and just console dialogue. 34 00:02:22,680 --> 00:02:27,960 The error argument to the console so we can see exactly what we're dealing with and I'm going to comment 35 00:02:27,990 --> 00:02:32,490 out the line down below which is currently causing the program to crash. 36 00:02:32,490 --> 00:02:39,430 Now I will clear the terminal out but rerun the command and what do we end up getting. 37 00:02:39,460 --> 00:02:41,760 We end up getting an error message now. 38 00:02:41,800 --> 00:02:48,250 What's inside of here is not as bad as what we had before but it still doesn't contain information that 39 00:02:48,250 --> 00:02:52,750 would be useful to someone unless they really knew a good deal about programming. 40 00:02:53,020 --> 00:02:58,790 So what we're going to do is just check for the existence of that error object right here. 41 00:02:58,990 --> 00:03:03,430 The if statement if there is an error we're gonna do one thing. 42 00:03:03,430 --> 00:03:07,390 Otherwise inside of the else statement we'll do something else. 43 00:03:07,390 --> 00:03:12,790 Now if there is an error we're going to go ahead and print a statement using console dot log something 44 00:03:12,790 --> 00:03:15,430 that a person would actually understand. 45 00:03:15,460 --> 00:03:21,810 Let's try unable to connect to whether service. 46 00:03:21,880 --> 00:03:22,840 Excellent. 47 00:03:22,850 --> 00:03:28,160 Now that we have that message showing up we can fill out the else part of the if statement in this case. 48 00:03:28,160 --> 00:03:34,510 We want to print our forecast exactly like we were already doing so on comment out that line down below. 49 00:03:34,740 --> 00:03:40,640 And then going to take the entire thing cut it out of its current location remove the extra lines and 50 00:03:40,640 --> 00:03:42,410 paste it right here inside of. 51 00:03:42,410 --> 00:03:45,340 Else so if error print an error message. 52 00:03:45,410 --> 00:03:47,840 Otherwise print that forecast. 53 00:03:47,840 --> 00:03:52,280 Now let's go ahead and try things out again from the terminal down below. 54 00:03:52,280 --> 00:03:54,590 I'm going to rerun the program and what do I get. 55 00:03:54,590 --> 00:04:00,440 Unable to connect to weather service showing up which is a great step in the right direction. 56 00:04:00,560 --> 00:04:05,390 Now that we have this in place let's go ahead and make sure that our app still works when the network 57 00:04:05,420 --> 00:04:06,200 request. 58 00:04:06,260 --> 00:04:09,170 Excuse me when the network connectivity is re enabled. 59 00:04:09,560 --> 00:04:13,360 So right here I am going to re enable Wi-Fi once again. 60 00:04:13,430 --> 00:04:17,540 I'll wait just a couple of seconds then we'll rerun the script down below. 61 00:04:17,680 --> 00:04:22,850 And this time there should not be an error and response should indeed show up. 62 00:04:22,850 --> 00:04:29,270 So right here I am going to fire that often what do I get I get my forecast clear throughout the day. 63 00:04:29,270 --> 00:04:34,950 It is currently fifty seven point seven five degrees with a zero percent chance of rain. 64 00:04:35,090 --> 00:04:36,060 And there we go. 65 00:04:36,080 --> 00:04:41,360 Now we have a little bit of error handling in our program making sure that when things don't go well 66 00:04:41,510 --> 00:04:44,800 we at least give the user information that's useful. 67 00:04:44,830 --> 00:04:51,320 And so in summary we have these two arguments error and response only one is ever going to be populated. 68 00:04:51,320 --> 00:04:53,640 The other is going to be undefined. 69 00:04:53,660 --> 00:04:58,170 So if we have a value for error there's not gonna be a value for response. 70 00:04:58,190 --> 00:05:02,990 If I have a value for response we're not going to have a value for error. 71 00:05:03,020 --> 00:05:04,970 So that's why our condition works so well. 72 00:05:04,970 --> 00:05:09,830 If there is an error then we know we have one and we'll print the message if there's no error then we 73 00:05:09,830 --> 00:05:14,170 know by definition we have a response and we can go ahead and use it. 74 00:05:14,180 --> 00:05:17,880 Now this isn't the only type of error we want to guard against. 75 00:05:17,900 --> 00:05:20,220 The other relates to user input. 76 00:05:20,270 --> 00:05:22,960 What if we get a bad set of coordinates. 77 00:05:23,030 --> 00:05:26,230 That's not going to be handled given our current setup. 78 00:05:26,240 --> 00:05:30,810 Let's go ahead and explore that by cracking open the you RL in the browser. 79 00:05:30,830 --> 00:05:37,080 So what I'm going to do is take this you El copy it to the clipboard and for the moment we're going 80 00:05:37,080 --> 00:05:43,010 to take it over to Chrome so I'm going to open it up in a new tab like we did a few videos ago. 81 00:05:43,110 --> 00:05:44,090 And what do I get back. 82 00:05:44,100 --> 00:05:47,040 I get back the weather forecast as expected. 83 00:05:47,040 --> 00:05:51,240 Now let's go ahead and mess up the input in the U.R.L. up above. 84 00:05:51,240 --> 00:05:56,430 We could go ahead and demonstrate this by removing the longitude from the you are well up above. 85 00:05:56,430 --> 00:05:59,160 I'm going to fire off their request and what do we get back. 86 00:05:59,160 --> 00:06:05,160 We do not get back a forecast because we haven't provided enough information for a dark sky to know 87 00:06:05,160 --> 00:06:08,950 where we want to get the forecast for. 88 00:06:09,170 --> 00:06:12,820 This is Andrew with a quick update for the weather stack API. 89 00:06:12,830 --> 00:06:15,610 We can also break this API though to get that done. 90 00:06:15,620 --> 00:06:17,960 We have to make a slightly different change. 91 00:06:17,990 --> 00:06:24,140 So right here we have our U.R.L. on the far right and we have our query in order to break the weather 92 00:06:24,140 --> 00:06:25,460 stack API. 93 00:06:25,460 --> 00:06:28,940 We'll just remove both the latitude and longitude. 94 00:06:29,150 --> 00:06:32,420 So right here we set query equal to nothing. 95 00:06:32,420 --> 00:06:38,260 And if I hit enter and fire off this request we can see that we don't get back a forecast. 96 00:06:38,270 --> 00:06:45,100 Instead we're getting back an error right here please specify a valid location identifier using of each 97 00:06:45,110 --> 00:06:46,590 query parameter. 98 00:06:46,610 --> 00:06:54,570 So this is the approach we can take to generate an error when working with the weather stack API so 99 00:06:54,570 --> 00:07:00,260 in this case we do indeed get a response with two properties we have the code property end the error 100 00:07:00,270 --> 00:07:02,340 or property on the response body. 101 00:07:02,670 --> 00:07:07,950 And in this case we need to add a little bit of defensive programming to make sure we print a useful 102 00:07:08,010 --> 00:07:11,640 error message to the user in this situation. 103 00:07:11,640 --> 00:07:17,790 So it's important to note that when we have invalid input the server the server in this case for Dark 104 00:07:17,790 --> 00:07:24,480 Sky might respond and it's gonna respond with data that might be considered an error but it's not going 105 00:07:24,480 --> 00:07:27,080 to populate this error object. 106 00:07:27,120 --> 00:07:33,990 This is used for lower level OS things like the complete lack of a network connection if the specific 107 00:07:33,990 --> 00:07:39,570 server you're contacting can't find the exact data you need that's typically going to come back on the 108 00:07:39,570 --> 00:07:40,890 response body. 109 00:07:41,160 --> 00:07:47,320 So right here we want to add an else if clause to our if statement to look at response and see if there 110 00:07:47,320 --> 00:07:53,250 is an error code set up if there is we'll print a different error message saying something like unable 111 00:07:53,250 --> 00:08:00,540 to find location otherwise once again we'll continue to print the forecast if we actually have the data 112 00:08:00,690 --> 00:08:03,270 we need right here before the else. 113 00:08:03,270 --> 00:08:08,550 I'm going to hit enter a couple of times adding some new lines we'll bring that back into the picture 114 00:08:08,550 --> 00:08:09,700 in just a moment. 115 00:08:09,810 --> 00:08:15,480 And on to the end of the current if statement we're going to add on and else if clause so we'll have 116 00:08:15,480 --> 00:08:19,560 our condition and the code to run if that condition is true. 117 00:08:19,560 --> 00:08:25,880 Now I can back the else clause up to the end of else if so if there is a low level OS error we're gonna 118 00:08:25,920 --> 00:08:32,010 print this message if this thing happens we'll do something else in a second otherwise we'll print the 119 00:08:32,010 --> 00:08:33,270 forecast. 120 00:08:33,270 --> 00:08:35,940 Now in this case we are going to look at response 121 00:08:38,410 --> 00:08:43,030 dat body and we're going to see if that error property exists. 122 00:08:43,030 --> 00:08:46,140 If it does we know that something has gone wrong. 123 00:08:46,150 --> 00:08:50,530 So right here we can use console dialog to print a message. 124 00:08:50,620 --> 00:08:58,070 And in this case let's do something like unable to find location unable to find location. 125 00:08:58,090 --> 00:09:01,200 Now we have some pretty decent error handling set up. 126 00:09:01,330 --> 00:09:05,090 If things fail at a low level we're gonna make sure we get that message. 127 00:09:05,140 --> 00:09:08,080 If things go wrong with the input we'll get another message. 128 00:09:08,080 --> 00:09:13,510 And finally if everything goes right we will indeed get our forecast showing up. 129 00:09:13,510 --> 00:09:15,170 Let's go ahead and test things out. 130 00:09:15,250 --> 00:09:20,680 So over here what I'm going to do is break you are L exactly like we broke it over there. 131 00:09:20,710 --> 00:09:25,950 I'm going to remove the comma and the long dude leaving just the latitude in place. 132 00:09:25,960 --> 00:09:31,660 This is Andrew with a reminder that for the weather stack API to break things we had to remove both 133 00:09:31,660 --> 00:09:33,820 the latitude and longitude. 134 00:09:33,940 --> 00:09:36,430 So right here I can remove both of those. 135 00:09:36,430 --> 00:09:39,010 So I have query equals nothing. 136 00:09:39,040 --> 00:09:42,320 Then I set up my other query parameter for units. 137 00:09:42,370 --> 00:09:47,410 This is what we'll need to do to break things using weather stack. 138 00:09:47,430 --> 00:09:54,220 Now let's go ahead and save the script and down below we're going to rerun the program so node apt J. 139 00:09:54,270 --> 00:09:54,730 S. 140 00:09:54,800 --> 00:10:00,710 Now I do have a network connection so there should not be a low level error but in this case I do have 141 00:10:00,710 --> 00:10:04,220 invalid input so I would expect this condition to run. 142 00:10:04,220 --> 00:10:07,370 I'm going to fire off the command and what do I get down below. 143 00:10:07,370 --> 00:10:09,870 Unable to find location. 144 00:10:09,920 --> 00:10:16,470 So now we have some pretty decent error handling set up allowing us to catch a lot of these edge cases. 145 00:10:16,490 --> 00:10:22,550 Now if we go ahead and fix things I'll add a comma on and I believe it was something like minus 1 1 146 00:10:22,550 --> 00:10:24,220 2 or 1 2 2. 147 00:10:24,380 --> 00:10:30,380 We can go ahead and save the program rerun things for a final time and ensure we are still getting the 148 00:10:30,380 --> 00:10:31,100 weather. 149 00:10:31,100 --> 00:10:37,220 Clearly I was off I got a lot colder and a short period of time but we do indeed have a valid coordinate 150 00:10:37,220 --> 00:10:43,580 pair and we are indeed getting to the end no low level errors no problems with the input which means 151 00:10:43,670 --> 00:10:49,610 we print the forecast now it's challenge time where you're going to do the same thing for our Geo coding 152 00:10:49,610 --> 00:10:50,230 request. 153 00:10:50,300 --> 00:10:55,630 So to kick things off I am going to comment out all of the code related to our weather request will 154 00:10:55,670 --> 00:10:57,930 obviously come back to that soon. 155 00:10:57,950 --> 00:11:02,750 I'm just commenting out so we don't have a bunch of different things printing to the terminal and down 156 00:11:02,750 --> 00:11:08,100 below we are going to uncommon the code for the geo coding API request. 157 00:11:08,330 --> 00:11:13,880 Now right here I had a couple comments to illustrate exactly how geo coding was going to fit into the 158 00:11:13,880 --> 00:11:14,950 big picture. 159 00:11:14,990 --> 00:11:19,940 I'm going to remove those and this is where I will paste in the challenge comments. 160 00:11:20,000 --> 00:11:25,610 Now in this case it's gonna be your job to setup error handling for the geo coding request and there 161 00:11:25,610 --> 00:11:27,630 are four steps for getting this done. 162 00:11:27,650 --> 00:11:34,220 Step one you want to set up an error handler for low level errors so that's when the error argument 163 00:11:34,280 --> 00:11:34,960 exists. 164 00:11:35,000 --> 00:11:37,040 And the response does not. 165 00:11:37,040 --> 00:11:42,500 In that case you can print a message like unable to connect to location services. 166 00:11:42,500 --> 00:11:47,900 Now once you have that in place I'd like you to test your work by disabling your network request and 167 00:11:47,900 --> 00:11:51,840 making sure that when you run the app you see that error message print. 168 00:11:51,920 --> 00:11:58,610 Instead of seeing a really long cryptic stack trace now inside of the else clause you're going to continue 169 00:11:58,610 --> 00:12:03,620 to do whatever you're currently doing so that handles the first type of error. 170 00:12:03,620 --> 00:12:09,080 The other one is to set up an error handler when there's no matching results and we're going to explore 171 00:12:09,080 --> 00:12:13,730 that right now by taking our you are from the browser and messing it up. 172 00:12:13,790 --> 00:12:19,970 So over here in my other tab I had that you RL we explored when we initially set up geo coding and if 173 00:12:19,970 --> 00:12:26,870 you remember the search term sits right here so it is forward slash geo coding forward slash v five 174 00:12:27,110 --> 00:12:33,590 forward slash map box dot places forward slash your search term dot Jason. 175 00:12:33,740 --> 00:12:36,390 So in our case we're searching for Los Angeles. 176 00:12:36,440 --> 00:12:41,510 If I search for something like twelve what what am I going to get back. 177 00:12:41,510 --> 00:12:43,320 I get back the following. 178 00:12:43,400 --> 00:12:49,240 We still have those same four root properties type query features and attribution. 179 00:12:49,240 --> 00:12:53,100 Then you'll notice that this time around features is an empty array. 180 00:12:53,180 --> 00:12:58,760 So if we are getting an empty array obviously we're not gonna be able to look in that array like we're 181 00:12:58,760 --> 00:13:02,790 doing right here to pull out the latitude and longitude. 182 00:13:02,810 --> 00:13:05,780 So you want to set up an else if like we did above. 183 00:13:05,870 --> 00:13:09,550 But you want to check if the features array has a length of zero. 184 00:13:09,560 --> 00:13:15,650 If it does you want to go ahead and print a message saying something like unable to find location. 185 00:13:15,650 --> 00:13:22,250 Try again with different search term then you want to go ahead and actually test that out by messing 186 00:13:22,250 --> 00:13:28,460 up the you are well over here to generate zero search results running the program and making sure you 187 00:13:28,460 --> 00:13:30,380 see that message print. 188 00:13:30,380 --> 00:13:36,560 So just to demonstrate if I do swap out Los Angeles in the you are well right here with something like 189 00:13:36,630 --> 00:13:37,130 12. 190 00:13:37,160 --> 00:13:39,240 What and save the file. 191 00:13:39,290 --> 00:13:42,060 I can indeed rerun the script down below. 192 00:13:42,110 --> 00:13:42,950 And what do I get. 193 00:13:42,950 --> 00:13:45,110 We're back to a big ugly stack trace. 194 00:13:45,110 --> 00:13:52,040 The problem being that there is no center property on undefined undefined being the object we're trying 195 00:13:52,040 --> 00:13:58,520 to access which does not exist in the features array because in this case the features array has zero 196 00:13:58,610 --> 00:13:59,810 items inside. 197 00:13:59,810 --> 00:14:04,390 I'm going to undo that change bringing the search term back to a valid one. 198 00:14:04,400 --> 00:14:06,770 Now it's time for you to knock this one out. 199 00:14:06,770 --> 00:14:11,660 Take a moment to pause the video test your work and when you're done come back and click play and we'll 200 00:14:11,660 --> 00:14:13,460 work through the solution together 201 00:14:17,350 --> 00:14:18,220 how'd that go. 202 00:14:18,220 --> 00:14:23,050 I'm going to start with step 1 and ensure that we're handling those low level errors. 203 00:14:23,050 --> 00:14:25,040 So right here what am I going to do. 204 00:14:25,060 --> 00:14:29,230 I am going to start by disabling my network connection. 205 00:14:29,230 --> 00:14:35,290 I'm gonna turn off Wi-Fi then if we were to rerun the program obviously things would indeed fail. 206 00:14:35,290 --> 00:14:37,820 Let's take a quick moment to do just that. 207 00:14:37,840 --> 00:14:40,050 I'll use the up arrow key and enter. 208 00:14:40,090 --> 00:14:41,050 And what do I get. 209 00:14:41,080 --> 00:14:47,680 I get the very long cryptic message saying that there is no response so we can't access the body property 210 00:14:47,740 --> 00:14:48,610 on it. 211 00:14:48,610 --> 00:14:53,120 We can address this by adding the if statement in if there is an error. 212 00:14:53,140 --> 00:14:55,480 Then we know we want to print a message. 213 00:14:55,480 --> 00:15:01,450 Otherwise inside of else we know there's a response and we can go ahead and do what we were doing before. 214 00:15:01,540 --> 00:15:03,300 So I'm going to take these three lines. 215 00:15:03,370 --> 00:15:08,090 You might have had just one if you chose to solve that challenge in a different way. 216 00:15:08,140 --> 00:15:11,760 I'm going to cut them out and bring them up inside of else. 217 00:15:11,890 --> 00:15:17,900 Once we have that in place we can go ahead and pick an error message for when there is no network connection. 218 00:15:17,980 --> 00:15:24,540 Right here a console that log call to print something and I'll use something like unable to connect 219 00:15:24,930 --> 00:15:27,340 to location services. 220 00:15:27,360 --> 00:15:28,410 Excellent. 221 00:15:28,410 --> 00:15:34,140 Now that we have this in place we've finished Step 1 at least hopefully and we can test things out down 222 00:15:34,140 --> 00:15:34,550 below. 223 00:15:35,010 --> 00:15:38,330 Once again I'll use the up arrow key and enter to run the script. 224 00:15:38,340 --> 00:15:42,960 And right here we get unable to connect to location services. 225 00:15:42,960 --> 00:15:49,380 Now if I was to read enable my network connection I would expect that we do indeed get a latitude and 226 00:15:49,380 --> 00:15:50,930 longitude printing. 227 00:15:51,090 --> 00:15:55,710 I'm going to rerun the program with the network enabled and what do I get right here. 228 00:15:55,710 --> 00:15:59,100 I do indeed get my coordinates which is awesome. 229 00:15:59,100 --> 00:16:03,780 Next up we want to make sure that when the search term returns no results. 230 00:16:03,780 --> 00:16:08,620 We do indeed print a message letting them know we can't find that location. 231 00:16:08,670 --> 00:16:12,750 First up let's recreate this error by messing up that search term. 232 00:16:12,750 --> 00:16:16,560 I'm going to remove Los Angeles I'll replace it with some mumbo jumbo. 233 00:16:16,560 --> 00:16:19,280 Like 12 followed by the word what. 234 00:16:19,380 --> 00:16:24,590 And now if we were to rerun the program once again we would be back into a failing state. 235 00:16:24,600 --> 00:16:28,620 And that's okay because we're gonna address that in just a moment right here. 236 00:16:28,620 --> 00:16:35,130 Cannot read property center of undefined so the undefined thing is the object we're trying to access 237 00:16:35,130 --> 00:16:39,720 from the features array the features array is empty in this case as we saw. 238 00:16:39,780 --> 00:16:43,040 So there is not going to be an object and that object doesn't exist. 239 00:16:43,050 --> 00:16:47,190 So it definitely won't have a center property to address this. 240 00:16:47,190 --> 00:16:48,530 All we're going to do is add. 241 00:16:48,530 --> 00:16:50,610 Else if like we did before. 242 00:16:50,610 --> 00:16:53,430 I'll move else down below for just a moment. 243 00:16:53,430 --> 00:16:53,800 Add. 244 00:16:53,790 --> 00:16:59,700 Else if with a condition and some code to run when that condition passes then I'll bring the else clause 245 00:16:59,700 --> 00:17:00,590 back into the mix. 246 00:17:00,600 --> 00:17:02,540 Tacking it on to the end. 247 00:17:02,550 --> 00:17:03,580 Excellent. 248 00:17:03,600 --> 00:17:05,870 Now what's the condition in this case. 249 00:17:05,970 --> 00:17:09,220 We want to run this code printing another error message. 250 00:17:09,240 --> 00:17:18,290 If the array is empty so if response dot body dot features has a length equal to zero. 251 00:17:18,300 --> 00:17:23,720 If it does that's a problem and we're going to print a message console dot log. 252 00:17:23,850 --> 00:17:27,780 I'll print something like unable to find location. 253 00:17:27,810 --> 00:17:31,850 Try another search perfect. 254 00:17:32,000 --> 00:17:37,490 Now that we have this in place we can move on to the final step which is to make sure we actually see 255 00:17:37,490 --> 00:17:38,230 this message. 256 00:17:38,240 --> 00:17:43,530 When that array is empty I'm gonna go ahead and rerun the program once again and what do I get. 257 00:17:43,550 --> 00:17:46,580 Unable to find location try another search. 258 00:17:46,580 --> 00:17:50,600 Now let's wrap things up by bringing it back to a working state. 259 00:17:50,630 --> 00:17:55,780 I'm going to remove 12 and what it'll be forward slash Philadelphia Dot. 260 00:17:55,820 --> 00:17:58,240 Jason I'm gonna save the program. 261 00:17:58,250 --> 00:18:00,860 That should indeed return a result. 262 00:18:00,860 --> 00:18:06,830 And if I rerun the program I would expect to see the coordinates for Philadelphia and that is exactly 263 00:18:06,890 --> 00:18:07,850 what I'm getting. 264 00:18:08,060 --> 00:18:14,090 So error handling isn't the most fun thing to add to your application but it goes a long way towards 265 00:18:14,090 --> 00:18:19,650 making sure you have a professional setup where users actually understand what's happening. 266 00:18:19,730 --> 00:18:25,980 If things fail for the moment I am going to remove those challenge comments and save the file. 267 00:18:26,000 --> 00:18:28,280 That's where we're going to stop for this one. 268 00:18:28,280 --> 00:18:34,430 We now have a pretty good setup printing the nicer results when we get them but obviously sometimes 269 00:18:34,430 --> 00:18:36,240 we don't go down that happy path. 270 00:18:36,260 --> 00:18:40,030 And in this case we are indeed also handling those errors. 271 00:18:40,040 --> 00:18:41,110 That's it for this one. 272 00:18:41,120 --> 00:18:42,560 I'll see you in the next one.