Skip to content

Fix undefined variable#35

Open
mimarcel wants to merge 5 commits intocode4romania:developfrom
mimarcel:fix/undefined_var_precinct
Open

Fix undefined variable#35
mimarcel wants to merge 5 commits intocode4romania:developfrom
mimarcel:fix/undefined_var_precinct

Conversation

@mimarcel
Copy link
Copy Markdown

No description provided.

@RaduCStefanescu
Copy link
Copy Markdown
Contributor

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

@RaduCStefanescu
Copy link
Copy Markdown
Contributor

Thanks for the PR @mimarcel !

Comment thread app/Helpers/PrecinctImporter.php Outdated
}
} catch (QueryException $ex){
Log::warning("Could not persist precinct \n $precinct");
$precinctNo = isset($rawPrecinctData['precinct_no']) ? $rawPrecinctData['precinct_no'] : "missing";
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

3 participants