Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wishes for FileIOException #3075

Closed
peter-ahe-google opened this issue May 16, 2012 · 7 comments
Closed

Wishes for FileIOException #3075

peter-ahe-google opened this issue May 16, 2012 · 7 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io

Comments

@peter-ahe-google
Copy link
Contributor

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.

@madsager
Copy link
Contributor

madsager commented Jun 7, 2012

Added this to the Later milestone.

@andersjohnsen
Copy link

By default, we want the exceptions to provide as much info as possible for quick debugging.

That said, it should be quite easy to customize the output of exceptions, as both FileException.message and OSError.message are available.

In the example above it be changed to:

print('Error reading ${relativize(cwd, uri)}: ${ex.osError.message}.');

If you are unable to extract the info needed, please open the issue again.


Added AsDesigned label.

@peter-ahe-google
Copy link
Contributor Author

I don't think the class OSError existed when I wrote this request. OSError definitely satisfies my second wish (and enables me to produce a better error message). Thank you for that.

I still wish that FileException would contain the name of the file.


Added Triaged label.

@andersjohnsen
Copy link

Set owner to @Skabet.
Added Started label.

@andersjohnsen
Copy link

I've landed FileException.path in r24523.


Added Fixed label.

@peter-ahe-google
Copy link
Contributor Author

Wow, I got two wishes granted! Thank you.

@kevmoo
Copy link
Member

kevmoo commented May 14, 2014

Removed Area-IO label.
Added Area-Library, Library-IO labels.

@peter-ahe-google peter-ahe-google added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io labels May 14, 2014
@peter-ahe-google peter-ahe-google added this to the Later milestone May 14, 2014
dart-bot pushed a commit that referenced this issue Sep 13, 2021
New commits in this version:

git -C third_party/pkg/pub log --oneline cd7a43f2109f7e5eb22e73c7f4e15d25fd57598e..d95c5713dda518ed53ada70e00789e6aadbfbe48
d95c5713 (HEAD, origin/master, origin/HEAD) Remove duplicate global invocation on Windows (#3055)
4c5198df master->main (#3101)
e793fd52 More tool/test.dart tweaks (#3097)
1b228edd Report retracted packages (#3093)
4fedb6c5 Tweak strict dependencies error message for `_validateBenchmarkTestTool` (#3087)
e608ab6e Improve test script (#3091)
abf702c4 Detect potential leaks in `dart pub publish`. (#3049)
9941c1f9 Fix broken simplification of prerelease constraints (#3078)
f0cdfa27 format (#3086)
5a1242c6 Fix unicode terminal detection windows (#2933)
58e2296d Dart format (#3084)
1426601c use incremental compilation in the tool/test.dart script (#3075)
9954f851 Fix a typo (#3062)
44489b31 Use relative import for path.dart (#2959)
77702ab1 Always precompile scripts before running them (#3074)

Change-Id: I913ab9e3b5bc7181d483a2de96ec4ad917028b75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213262
Reviewed-by: Jonas Jensen <[email protected]>
Commit-Queue: Sigurd Meldgaard <[email protected]>
copybara-service bot pushed a commit that referenced this issue Jul 12, 2022
…4 revisions)

https://dart.googlesource.com/dartdoc/+log/adc5a45ddafb..621c9192cc24

2022-07-12 [email protected] Move annotation tests out of end-to-end test (#3078)
2022-07-11 [email protected] Move test skip above test body (#3076)
2022-07-11 [email protected] Remove ElementType.returnedFrom; was completely unused (#3077)
2022-07-09 [email protected] Make Mixin.superclassConstraints late final non-nullable (#3075)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-doc-dart-sdk
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: [email protected]
Change-Id: I82e92bf6c915969b2ba72de470939673f63b4de9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251161
Commit-Queue: Nate Bosch <[email protected]>
Reviewed-by: Nate Bosch <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Projects
None yet
Development

No branches or pull requests

4 participants