Skip to content

Wishes for FileIOException #3075

Closed
Closed
@peter-ahe-google

Description

@peter-ahe-google

I'm currently looking at what dart2js reports when it cannot read a file and noticed a few things about FileIOException that I wish were different.

  1. I wish that I could extract the file name directly from the exception object.
  2. I wish the osError field had a less low-level feel to it.

Currently, this is how I deal with FileIOException:

...
    } catch (FileIOException ex) {
      print('Error reading ${relativize(cwd, uri)}: ${ex.osError}.');
      exit(1);
    }

This prints:

Error reading fiskefisk: OS Error: No such file or directory, errno = 2.

This message contains a lot of information that is nice for a developer, but to my user, I would like to simply print:

Error reading fiskefisk: No such file or directory.

Metadata

Metadata

Assignees

Labels

area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-io

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions