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

ofxNetwork : wrongly reported errors #6457

Closed
oxillo opened this issue Nov 16, 2019 · 7 comments
Closed

ofxNetwork : wrongly reported errors #6457

oxillo opened this issue Nov 16, 2019 · 7 comments
Milestone

Comments

@oxillo
Copy link
Contributor

oxillo commented Nov 16, 2019

ofxNetwork may report errors that should be ignored.
This happens when there are construct like :

int err= ofxNetworkCheckError();
if ( err != OFXNETWORK_ERROR(NOTSOCK) ){
	// Ignore this error
}

As ofxNetworkCheckError() gets the error and logs it, all the errors will be reported even if they should be ignored.

This explains the error seen here:

[  error ] ofxNetwork: C:/projects/openframeworks/addons/ofxNetwork/src/ofxTCPManager.cpp: 200 ENOTSOCK: socket argument is not a socket

https://ci.appveyor.com/project/arturoc/openframeworks/builds/28847653/job/0duai87vuou8ctv7#L1358

Originally posted by @ofTheo in #6412 (comment)

Proposal

  • Deprecate ofxNetworkCheckError()
  • Add int ofxNetworkGetLastError() to return the last error
  • Add void ofxNetworkLogError(int err, const char* file, int line) to log an error that happened on line line in file file
  • Add ofxNetworkLogLastError() that is a shortcut for ofxNetworkLogError(ofxNetworkGetLastError(), __FILE__, __LINE__)
@oxillo oxillo mentioned this issue Nov 16, 2019
35 tasks
@ofTheo ofTheo mentioned this issue Dec 1, 2019
48 tasks
@ofTheo ofTheo added this to the 0.11.1 milestone Dec 1, 2019
@P-v-K
Copy link

P-v-K commented Dec 13, 2019

Should that read "all the errors will be ignored even if they should be reported."?

@oxillo
Copy link
Contributor Author

oxillo commented Dec 23, 2019

It's more "all the errors will be reported even if they should be ignored". I'll edit the post to make it clearer.

@ofTheo
Copy link
Member

ofTheo commented Jan 27, 2021

@oxillo so would ofxNetworkGetLastError() return no error for errors that can be safely ignored?
By the way I have also seen this issue occasionally on the CI for macOS makefile tests.

@ofTheo
Copy link
Member

ofTheo commented Jan 29, 2021

This is one of the last issues left before we can release 0.11.1.
I get the sense that it could be quite a lot of changes. Do you think we should push this to 0.11.2 / 0.12 ?

@P-v-K
Copy link

P-v-K commented Jan 29, 2021

I have no opinion on pushing or fixing, as I just ran into it once and it hasn't been impacting my current work. Maybe it could be mentioned in the documentation to help people be more likely to figure out what's (not) happening if/when they do run into it? Because once you know, and find the lines of code mentioned, you could hack it to do what you want? Just a thought, trying to be helpful. Again, I don't have enough knowledge/experience with it to have a strong opinion.

@oxillo
Copy link
Contributor Author

oxillo commented Jan 29, 2021

The idea behind my proposal is to separate getting the error and logging it.
So you can decide to print or not the error.
See/Comment the above PR

@ofTheo
Copy link
Member

ofTheo commented Jan 31, 2021

closed by #6675

@ofTheo ofTheo closed this as completed Jan 31, 2021
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

No branches or pull requests

3 participants