Skip to content

[proposal] make ofxOsc strong#4998

Merged
arturoc merged 2 commits intoopenframeworks:masterfrom
2bbb:PR/strong_ofxOsc
Mar 16, 2016
Merged

[proposal] make ofxOsc strong#4998
arturoc merged 2 commits intoopenframeworks:masterfrom
2bbb:PR/strong_ofxOsc

Conversation

@2bbb
Copy link
Contributor

@2bbb 2bbb commented Mar 16, 2016

for example, we wrote like this:

    ofxOscReceiver receiver;
    void setup() { receiver.setup(9005); }

and we do in terminal.app (or similar)

$ nc -4u localhost 9005
> a

maybe your app got crush.
so, this process is too extreme.
but, recently, some app got bad packet and crushed 10 machines at same time. (maybe bad packet is broadcasted)
i think this is very critical.

and, more critical point is "we cannot catch this exception from the outside now."

now, this PR is first aid.
(but, i hope to be accepted this PR as soon as possible.)

i think good solution is:
doing propagate exception with std::promise, std::future, or std::async.
or, simply, replace ofLog (is implemented now) with send error message with ofThreadChannel when catch exception. and notify error.
or, is this OK?

i don't know policy of exception handling in oF.
and i want to discuss for bright future we can use osc in peace.

best regards.

@arturoc
Copy link
Member

arturoc commented Mar 16, 2016

i want to look into adding more expresive error handling, we don't throw exceptions but something that returns an error object with more information about the error would be really useful.

by now, can you just return a boolean from setup to indicate that it was correctly setup or not

if return false then setup failed.
@2bbb
Copy link
Contributor Author

2bbb commented Mar 16, 2016

@arturoc
thanks for comment.

i have 1 idea as following:

void setup() {
    receiver.setup(8888);
    ofAddListener(receiver.gotOscError, this, &ofApp::oscError);
}

void oscError(std::string &what) {
    ofLogWarning() << what;
}

if we got error then this example print like:

[warning] element size must be multiple of four

and this is already implement in this repo (is first aid for worrier).

maybe this implementation can make error handling more expressive.

"return a boolean from setup" is mean like above commit?
so, for example, you bind same port in 2 apps, then don't crush and print error logs, and setup return false.
(this commit doesn't include imeplements of notify error message. if it seems to ok, i can merge soon.)

arturoc added a commit that referenced this pull request Mar 16, 2016
[proposal] make ofxOsc strong
@arturoc arturoc merged commit d8d7ff5 into openframeworks:master Mar 16, 2016
@arturoc
Copy link
Member

arturoc commented Mar 16, 2016

Thanks!

i don't think having to register an event to receive the possible errors. as i said i want to look into a generic solution for returning errors conditions so let's leave it as it is by now and we can com back to it once we figure it out

@2bbb
Copy link
Contributor Author

2bbb commented Mar 16, 2016

👍

@2bbb 2bbb deleted the PR/strong_ofxOsc branch March 16, 2016 23:42
@valillon
Copy link

valillon commented May 4, 2017

It seems related to the issue #5514. It would be nice to have some feedback here : )
Another recent handle exception in ofxOsc here #5467.

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