neverthrow
neverthrow copied to clipboard
Getting ERR_UNHANDLED_REJECTION when using fromPromise to read non-existent files.
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
}
`
I am also experiencing this issue. I think this should be addressed. Are you able to reproduce @supermacro ?
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?