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

Replaced perror() calls with an error buffer. Issue #10 #49

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

andreondra
Copy link
Contributor

Fixes the issue #10. As @hroncok suggested, any subsequent call will replace the current message without concatenation.

@andreondra andreondra marked this pull request as draft March 25, 2022 16:35
@andreondra
Copy link
Contributor Author

Changed to WIP until the previous PR is merged.

@hroncok
Copy link
Member

hroncok commented Mar 25, 2022

It would be easier to me to review chnages in isolation, rather than on top of each other. How's your git-fu wrt branches? Are you able to submit each individual change from a different branch?

src/shared.c Show resolved Hide resolved
@andreondra
Copy link
Contributor Author

Yes, that's what I plan to do next, I just kinda forgot about it while resolving the first issue. Sorry for a little mess.

@andreondra
Copy link
Contributor Author

Note: removed irrelevant commits in this PR.

@andreondra andreondra marked this pull request as ready for review April 18, 2022 21:22
Copy link
Member

@hroncok hroncok left a comment

Choose a reason for hiding this comment

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

Basic testing shows this behaves mostly as expected, thanks!

As far as API goes, it would be really nice if I could get the concentrated error message programmatically without printing it to stderr. Imagine this scenarios:

  • I develop a GUI and I want to process an STL file. When I open it and an error happens, I want to show the message in a GUI error window.
  • I develop Python bindings. When Python code opens the STL file and an error happens I want to include the entire message in the Python exception.

Currently, I can only get the error_buffer part, or print the full error message to stdout.

src/util.c Outdated Show resolved Hide resolved
src/util.c Outdated Show resolved Hide resolved
src/stl_io.c Outdated Show resolved Hide resolved
@hroncok
Copy link
Member

hroncok commented Apr 25, 2022

As far as API goes, it would be really nice if I could get the concentrated error message programmatically without printing it to stderr. Imagine this scenarios:

  • I develop a GUI and I want to process an STL file. When I open it and an error happens, I want to show the message in a GUI error window.
  • I develop Python bindings. When Python code opens the STL file and an error happens I want to include the entire message in the Python exception.

Currently, I can only get the error_buffer part, or print the full error message to stdout.

Oh, ignore me, I must have been tired when writing this. The entire error message is stored in the error attribute, as it should be.

andreondra and others added 2 commits April 25, 2022 12:55
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
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

2 participants