On Fri, Oct 30, 2015 at 2:17 PM, Alican Çubukçuoğlu <
alicancubukcuo...@gmail.com> wrote:
> The recommended way of checking for file existence in Node.js is calling
> `fs.stat()` on the file. If no error was passed to the callback, it exists.
> If "ENOENT" was passed, it doesn't.
>
> If you "promi
The recommended way of checking for file existence in Node.js is calling
`fs.stat()` on the file. If no error was passed to the callback, it exists.
If "ENOENT" was passed, it doesn't.
If you "promisify" `fs.stat()` and use it with async/await, it throws when
a file doesn't exist so you end up wri
Syntax sugar similar to Go error handling would be much more useful, at
least for me :
let [err, result] = try JSON.parse('invalid');
On Oct 30, 2015 5:33 PM, "Mohsen Azimi" wrote:
> This would be nice with `await` but how would you specify the boundary?
>
> ```
> let json = try await (await fet
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.mcgloth...@gmail.com> wrote:
> It'd be nice if you could just do t
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
5 matches
Mail list logo