node-request-context icon indicating copy to clipboard operation
node-request-context copied to clipboard

make sure the context exists before attempting to access its properties

Open jfstgermain opened this issue 7 years ago • 6 comments

jfstgermain avatar Apr 13 '18 19:04 jfstgermain

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

TheBenji avatar Nov 07 '18 16:11 TheBenji

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

guyguyon avatar Nov 13 '18 09:11 guyguyon

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

TheBenji avatar Nov 13 '18 10:11 TheBenji

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

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

guyguyon avatar Nov 13 '18 12:11 guyguyon

Any reason for this PR to remain stale..?

eladchen avatar Jun 09 '19 13:06 eladchen

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

guyguyon avatar Aug 26 '19 17:08 guyguyon