stackgl / shader-school

:mortar_board: A workshopper for GLSL shaders and graphics programming
Other
4.28k stars 252 forks source link

Reloading browser if shader has syntax error crashes app #80

Closed julescarbon closed 9 years ago

julescarbon commented 10 years ago

For instance in this bogus answer to intro-06 I have failed to declare a variable and used "var" instead of int (bad habits from writing Javascript). Reloading the lesson to refresh it (another bad habit) crashes the app.

mat2 matrixPower(highp mat2 m, int n) {
  for (var i = 0; i < n; i++) {
    mm = mm * m;
  }
  return mm;
}

Additionally, the following stack trace:

http.js:689
    throw new Error('Can\'t set headers after they are sent.');
          ^
Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (http.js:689:11)
    at bail (/usr/local/lib/node_modules/shader-school/node_modules/glslify-live/server.js:138:9)
    at Stream.<anonymous> (/usr/local/lib/node_modules/shader-school/node_modules/glslify-live/server.js:100:23)
    at Stream.f (/usr/local/lib/node_modules/shader-school/node_modules/glslify-live/node_modules/once/once.js:16:25)
    at Stream.EventEmitter.emit (events.js:117:20)
    at Stream.EventEmitter.emit (events.js:117:20)
    at Stream.onerror (/usr/local/lib/node_modules/shader-school/node_modules/glslify-live/node_modules/glslify-bundle/node_modules/glslify-stream/node_modules/stream-combiner/index.js:29:18)
    at Stream.EventEmitter.emit (events.js:117:20)
    at parseexpr (/usr/local/lib/node_modules/shader-school/node_modules/glslify-live/node_modules/glslify-bundle/node_modules/glslify-stream/node_modules/glsl-parser/lib/index.js:597:16)
robert-chiniquy commented 9 years ago

Just noticed this issue. I pushed this pr earlier to stop the crash: https://github.com/hughsk/glslify-live/pull/2