Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
Move props.path check below class init (#55)
Browse files Browse the repository at this point in the history
`self.error` is not available until the prototype is available

PR-URL: #55
Credit: @ZJONSSON 
Reviewed-By: @zkat
  • Loading branch information
ZJONSSON authored and zkat committed Mar 7, 2017
1 parent 24fabde commit ac4a9e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ function Reader (props, currentStat) {
props = { path: props }
}

if (!props.path) {
self.error('Must provide a path', null, true)
}

// polymorphism.
// call fstream.Reader(dir) to get a DirReader object, etc.
// Note that, unlike in the Writer case, ProxyReader is going
Expand Down Expand Up @@ -85,6 +81,10 @@ function Reader (props, currentStat) {

Abstract.call(self)

if (!props.path) {
self.error('Must provide a path', null, true)
}

self.readable = true
self.writable = false

Expand Down
4 changes: 2 additions & 2 deletions lib/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ function Writer (props, current) {
props = { path: props }
}

if (!props.path) self.error('Must provide a path', null, true)

// polymorphism.
// call fstream.Writer(dir) to get a DirWriter object, etc.
var type = getType(props)
Expand Down Expand Up @@ -61,6 +59,8 @@ function Writer (props, current) {

Abstract.call(self)

if (!props.path) self.error('Must provide a path', null, true)

// props is what we want to set.
// set some convenience properties as well.
self.type = props.type
Expand Down

0 comments on commit ac4a9e3

Please sign in to comment.