AceMetrix / bower-license

Generates a list of bower dependencies
Apache License 2.0
15 stars 29 forks source link

Add error handling #11

Closed ptusch closed 9 years ago

ptusch commented 9 years ago

Error handling will be a pleasure for external libraries. A basic throw will stop the entire process and there won't be a return or callback.

Now you receive an error if you have no bower_components or something went wrong with bower-json.

mojoaxel commented 9 years ago

:+1:

anacronw commented 9 years ago

cool, if we're going to do this, I actually prefer to switch the arguments around with err being first. What do you think?

mojoaxel commented 9 years ago

Thats propably a matter of personal taste. I myself like it more at the end, but I don't care much.

ptusch commented 9 years ago

I don't think you can switch the arguments around without breaking code of existing applications. If application X doesn't support proper checks for the result (and you can't expect that!), it will fail horribly for them.

See this for clarification: http://pastebin.com/abA2aKRv

ptusch commented 9 years ago

Any thoughts about the PR/idea from the maintainer? I'd love to use error handling. For now I use a 500 ms timeout which is just wrong and ugly.

anacronw commented 9 years ago

It looks good, thanks

ptusch commented 9 years ago

Thank you very much! :)