Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
jasnell committed Mar 9, 2016
commit a255da40d1de13c918223b4c814d79376ced0ccb
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down