Skip to content
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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

mimarcel
Copy link

No description provided.

@RaduCStefanescu
Copy link
Contributor

@claudiunicolaa
@andrei1489
Could you please review these changes?
Thank you!

@RaduCStefanescu
Copy link
Contributor

Thanks for the PR @mimarcel !

@@ -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";
Copy link
Contributor

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.

Copy link
Contributor

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. 😄

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants