neverthrow icon indicating copy to clipboard operation
neverthrow copied to clipboard

Getting ERR_UNHANDLED_REJECTION when using fromPromise to read non-existent files.

Open adhocmaster opened this issue 2 years ago • 2 comments

Getting ERR_UNHANDLED_REJECTION when using fromPromise to read non-existent files.

`
import { readFile } from 'node:fs/promises'; public read(path: string): ResultAsync<string, Error> {

    const res = ResultAsync.fromPromise(
        readFile(path, 'utf8'),
        (e) => new Error(`cannot read file ${path}`)
    )
    
    return res
}

`

adhocmaster avatar Jul 27 '23 23:07 adhocmaster

I am also experiencing this issue. I think this should be addressed. Are you able to reproduce @supermacro ?

azimlumos avatar May 03 '24 05:05 azimlumos

can't reproduce here: https://github.com/Schniz/neverthrow/blob/schniz/test-nonexistent-path-in-fs/tests/fs.test.ts can you suggest what I can do to reproduce that? I'm running on MacOS, maybe you're using Windows or Linux and it behaves differently?

Schniz avatar Aug 05 '24 05:08 Schniz