Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

jsgi error module #24

dmachi opened this Issue Feb 3, 2013 · 0 comments


None yet
1 participant

dmachi commented Feb 3, 2013

When trying to throw an AccessError, I ran into a problem at


Basically, e instanceof AccessError is always false. I'm wondering if it is because they don't come from the same physical file. I load require("perstore/errors").AccessErrors which pulls in ./node_modules/perstore/errors.js. However, pintura's jsgi module, which uses the same require, loads ./node_modules/pintura/node_modules/perstore/errors.js . This ends up causing the instanceof operator to fail.

For now I've worked around this issue by changing the check to be:
if (e instanceof AccessError || (e.name && e.name=="AccessError"))

Which seems to do the trick for me for now, but perhaps there is a better way to fix this issue?

@dmachi dmachi closed this Feb 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment