purescript-deprecated / gulp-purescript

Gulp plugin providing PureScript compiler tasks
34 stars 8 forks source link

Error: no writecb in Transform class #37

Closed farnoy closed 9 years ago

farnoy commented 9 years ago

Hi,

I'm setting up for purescript development and I've had gulp already, so I tried this:

gulp = require("gulp")
purescript = require("gulp-purescript")

gulp.task "purescript", ->
  gulp.src("./src/*.purs")
    .pipe(purescript.psc())
    .pipe(gulp.dest("./build/purescript"))

I get

[12:35:07] Using gulpfile /data/chat/frontend/gulpfile.coffee
[12:35:07] Starting 'purescript'...
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: no writecb in Transform class

And if I remove the pipe(gulp.dest(...)) call

[12:37:05] Starting 'purescript'...
[12:37:05] 'purescript' errored after 36 ms
[12:37:05] Error in plugin 'gulp-purescript'
Message:
    Type mismatch: expected object, found undefined
farnoy commented 9 years ago

Alright nevermind, specifying the main module in psc(...) has fixed the issue.

ethul commented 9 years ago

Glat it works. I will take a look at that error message. It looks like the underlying error is being hidden. Thanks for the report.

porglezomp commented 9 years ago

In addition to looking at the error message, the example gulpfile should probably be changed to a valid one, since it causes this same error.

ethul commented 9 years ago

@porglezomp Good catch on the README. I've opened #42 for this.

porglezomp commented 9 years ago

Also, one final gotcha, it would be nice the module: argument was more permissive and treated 'Main' the same as ['Main']. This probably won't matter much once the error messages are fixed though.

On the topic of the error message, while I was searching around and running into bug reports on other plugins, I found multiple references to exceptions not being caught by the plugin and bubbling up to a catchall somewhere inside gulp itself that produces the bad error message.

ethul commented 9 years ago

Let's get a fix in for the error messages first and see how that goes. If we need more flexibility in the type of the module argument we can look into adding that afterwards. And good to know about the catchall. I will do some digging on this.