othiym23 / node-continuation-local-storage

implementation of https://github.com/joyent/node/issues/5243
BSD 2-Clause "Simplified" License
1.13k stars 207 forks source link

node 0.12 fails when CLS attempts to add error@context to the error #50

Open dimichgh opened 8 years ago

dimichgh commented 8 years ago

https://github.com/othiym23/node-continuation-local-storage/blob/master/context.js#L52

message: Cannot assign to read only property 'error@context' of illegal access stack: TypeError: Cannot assign to read only property 'error@context' of illegal access at ServerResponse. (/node_modules/continuation-local-storage/context.js:77:31)

gergelyke commented 8 years ago

It should be fixed now - I think we can close it, don't wee @othiym23 ?

carlisliu commented 7 years ago

TypeError occurs ( https://github.com/othiym23/node-continuation-local-storage/blob/master/context.js#L53 ) when throwing a string instead of an error object in strict mode. like this:

TypeError: Cannot create property 'error@context' on string 'error' at Object. (E:\WorkSpace\express-example\strict.js:4:20) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3

Because a property can not be assigned to a string in strict mode.