Skip to content
Permalink
Browse files

fs: improve error message for invalid flag

Flags on fs.open and others can be passed as strings or int.
Previously, if passing anything other than string or int,
the error message would only say that flags must be an int.

PR-URL: #5590
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information...
jasnell committed Mar 7, 2016
1 parent 3c84752 commit 8bb60e3c8dde6f0c0295309291b4022937072c04
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/fs.js
@@ -536,8 +536,8 @@ fs.readFileSync = function(path, options) {

// Used by binding.open and friends
function stringToFlags(flag) {
// Only mess with strings
if (typeof flag !== 'string') {
// Return early if it's a number
if (typeof flag === 'number') {
return flag;
}

0 comments on commit 8bb60e3

Please sign in to comment.
You can’t perform that action at this time.