maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
726 stars 58 forks source link

Errorhandling? #54

Open maralorn opened 11 years ago

maralorn commented 11 years ago

Hello,

I am using iced quite a lot ant it is totally awesome. Thanks for the great work. My question could probably already benn discussed, I would be totally satisfied with a link then. (I did not find anything.)

In the documentation you write, that try … catch … statements do not work with await and defer. (Which is obviously true.) For me this results very often in code like this:

fn1 = (cb) ->
  …
  await fn2 defer error, value
  return cb error if error?
  …
  cb null, value

I use callbacks, which always take errors as first argument, which I have also seen in some libraries.

So now my question: Is it theoretically impossible to make the javascript error handling work again? I thought about it and am seeing the caveats. But you most certainly now more about this matter.

If it is possible I would actually be willing to contribute. You could just point out a direction and i will give at try. else I would be very happy about some hints on how I can avoid my handmade error handling.

If this isn't the right place for a request like this, I apologize…

Greetings Malte

ashtuchkin commented 11 years ago

Please see #35 - we've almost nailed it.