-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix undefined variable #35
base: develop
Are you sure you want to change the base?
Fix undefined variable #35
Conversation
@claudiunicolaa |
Thanks for the PR @mimarcel ! |
app/Helpers/PrecinctImporter.php
Outdated
@@ -130,7 +130,9 @@ private function importPrecinctsFromArray(array $data) | |||
$precinct->save(); | |||
} | |||
} catch (QueryException $ex){ | |||
Log::warning("Could not persist precinct \n $precinct"); | |||
$precinctNo = isset($rawPrecinctData['precinct_no']) ? $rawPrecinctData['precinct_no'] : "missing"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point here! But if $rawPrecinctData['precinct_no']
or $rawPrecinctData['city_id']
aren't set, the method will throw a ErrorException
with the message Undefined index: precinct_no
(or city_id
) at line 121
.
If you have time, take into consideration before using that two array values to check if are set and if not to throw an OutOfBoundsException
that will be caught as well at line 132
.
Let me know on Slack if you need any help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the method was written for someone else, but now I saw that problem. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I changed the catch to handle all exceptions.
No description provided.