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

refactor(ext/fs): align error messages #25414

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

irbull
Copy link
Contributor

@irbull irbull commented Sep 4, 2024

Aligns the error messages in the ext/fs folder to be in-line with the Deno style guide.

#25269

Aligns the error messages in the ext/fs folder to be in-line with the
Deno style guide.

denoland#25269
Copy link
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, left a comment. Let me know what you think

ext/fs/30_fs.js Outdated
@@ -776,11 776,15 @@ function checkOpenOptions(options) {
(val) => val === true,
).length === 0
) {
throw new Error("OpenOptions requires at least one option to be true");
throw new Error(
"Cannot open file: `options` requires at least one option to be true",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use the same quoting style as the other changes in this PR?

Suggested change
"Cannot open file: `options` requires at least one option to be true",
"Cannot open file: 'options' requires at least one option to be true",

That said I'm not sure about the wording for these messages. The error is thrown before it was attempted to open the file, so the Cannot open file bit is confusing to me. It's good that we're hinting as to which fs option was called. Maybe having that in the stack trace is enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 for the quoting styles. I've noticed a real mixed bag, let's go with single quotes like you have here.

As for the error message, the checkOpenOption seems to only be used during the open and openSync functions, so from a callers perspective, the "File could not be opened" because of this error. I'm happy to drop it though it that's confusing, and of course the stack trace will be there too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the "Cannot open file" prefix and aligned the quoting styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants