Just try
Mohsen Azimi
me at azimi.me
Fri Oct 30 16:32:53 UTC 2015
This would be nice with `await` but how would you specify the boundary?
```
let json = try await (await fetch('file'.json).json());
```
should that throw on `.json()` now?
On Fri, Oct 30, 2015 at 6:48 AM Michael McGlothlin <
mike.mcglothlin at gmail.com> wrote:
> It'd be nice if you could just do try {} without all the catch and finally
> stuff because about half the time the logic is simpler if I can just put
> all the error handling code in one place at the end. I end up with a lot of
> empty catch (err){} laying around waiting to break something. And using one
> large try/catch/finally block isn't really workable either because I don't
> want an exception to break the flow.
>
> Of course it'd be nice if there was syntax to shorten
>
> let test = undefined;
> try {
> test = testSomething();
> } catch ( err ) {}
>
> into just
>
> let test = try testSomething() || undefined;
>
> Possibly where without the `|| undefined` test would contain an Error
> instance that's flagged as thrown or such. An Error flagged as thrown
> should evaluate as false so that logic ops work.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151030/69fffb25/attachment.html>
More information about the es-discuss
mailing list