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

make sure the context exists before attempting to access its properties #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jfstgermain
Copy link

No description provided.

this.context[eid][key] = val;
if (this.context[eid]) {
this.context[eid][key] = val;
}
Copy link
Owner

Choose a reason for hiding this comment

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

Good idea. I guess you should throw an error if it doesn't exist

@TheBenji
Copy link

TheBenji commented Nov 7, 2018

Can we merge this? This would be a great addition for us too!

@guyguyon
Copy link
Owner

@TheBenji I wonder if we want to throw exception in that case

@TheBenji
Copy link

A clear exception would be fine but intuitively I'd expect it to return undefined just the same as if I hadn't set the key in the first place I guess

@guyguyon
Copy link
Owner

I meant to throw exception in case you don't have executionAsyncId

if (this.context[eid]) {
     this.context[eid][key] = val;
} else {
   throw ....
}

@eladchen
Copy link

eladchen commented Jun 9, 2019

Any reason for this PR to remain stale..?

@guyguyon
Copy link
Owner

@eladchen Yes. I've asked about throwing an exception, and there is a conflict to resolve

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.

4 participants