maxtaco/tamejs — Issue #26: Streamline error handling
Author: MSch
Created: 2011-12-05 03:40:46+00:00
State: open

It'd be nice to have some syntax extensions to streamline error handling according to node-convention.

I propose finding a better way to express

```
var bcryptShortcut = function (data, autocb) {
await bcrypt.gen_salt(defer(var err, salt));
if (err)
return err;
await bcrypt.encrypt(data, salt, defer(var err, hash));
if (err)
return err;
return undefined, hash;
};

await bcryptShortcut("B4c0/\/", defer(var err, encrypted));
```

For example:

```
var bcryptShortcut = function (data, autocberr) {
await bcrypt.gen_salt(defer(autoerr, var salt));
await bcrypt.encrypt(data, salt, defer(autoerr, var hash));
return hash;
};

await bcryptShortcut("B4c0/\/", defer(var err, encrypted));
```

What do you think? How hard would it be to implement this transformation?