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

nltool: report line number when an exception occurs #11564

Merged
merged 1 commit into from
Oct 25, 2023
Merged

nltool: report line number when an exception occurs #11564

merged 1 commit into from
Oct 25, 2023

Conversation

stonedDiscord
Copy link
Contributor

I tried to convert a KiCad netlist and when a component value was missing or not a number nltool would only report Exception caught: Error converting string to number: but not what component or line was meant.

This PR counts the lines, prints the line number to stderr and passes on the exception.

@rb6502 rb6502 merged commit 4654a36 into mamedev:master Oct 25, 2023
5 checks passed
Comment on lines +343 to +347
catch (plib::pexception &e)
{
fprintf(stderr, "Error on line: <%d>\n", linenumber);
throw(e);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are three issues here:

  • You should catch by const reference unless there’s a very good reason not to.
  • throw is not a function and shouldn’t be formatted like one – it’s a flow control construct like return.
  • You should use throw; on its own to re-throw a caught exception.

@cuavas
Copy link
Member

cuavas commented Oct 25, 2023

@rb6502 can you please fix this up? It fails on basic C++.

@stonedDiscord
Copy link
Contributor Author

stonedDiscord commented Oct 26, 2023

I could fix those up when I'm back from my vacation in a week unless someone else wants to beat me to it

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