TritonDataCenter / node-verror

Rich JavaScript errors
MIT License
1.18k stars 61 forks source link

Feature-Request: browser compatibility #60

Open mattmeye opened 6 years ago

mattmeye commented 6 years ago

If i use angular with verror, i get

ERROR in ./node_modules/assert-plus/assert.js Module not found: Error: Can't resolve 'stream' in '..\myapp\node_modules\assert-plus'

in the compiler

TheDocTrier commented 6 years ago

I'm not an expert in the project by any means, but I'm pretty sure that it only supports a NodeJS environment. When you use Angular, you're trying to use verror in a browser environment (which doesn't have modules such as "stream" available). This doesn't look like it's an issue with verror, unless this is meant to be a feature request for implementing a browser version of verror. If that was done, it would probably have to be in a limited form.

It appears actually that the error you're getting isn't even from verror directly but from one of its dependencies. Unless verror switches dependencies or re-implements their own version which doesn't require any node modules, they can't fix this "issue."

mattmeye commented 6 years ago

yes you are right, i changed the title to a feature request.

benwinding commented 5 years ago

Is there any progress on this, would love to use this in an Angular app too!

davepacheco commented 5 years ago

I don't know of anybody working on it. Sorry.

bertho-zero commented 5 years ago

I opened a PR exactly for that: https://github.com/joyent/node-verror/pull/59

bertho-zero commented 4 years ago

I just published @openagenda/verror, it's a complete rewrite with some changes:

  • Rewritten with ES classes
  • Is now browser compatible, no more dependencies linking it to Node
  • findCauseByType and hasCauseWithType methods have been added
  • SError class has been removed

https://www.npmjs.com/package/@openagenda/verror

~BREAKING CHANGE: The VError creation without new keyword is no longer available.~

And I fixed this issue: https://github.com/joyent/node-verror/issues/78

jfmmm commented 3 years ago

@bertho-zero Your fork on bitbucket seem to be private, unless it was deleted. Can you make that public.

bertho-zero commented 3 years ago

I extracted the repo: https://github.com/Oagenda/verror

I reverted to using prototypes rather than classes so I could create errors without new, like Error.

fabis94 commented 3 years ago

@bertho-zero any chance you can also add TypeScript types? would be much appreciated

bertho-zero commented 3 years ago

I've never used TypeScript, but someone familiar with it can open a PR.