 # Note: if the *error* event is emitted, this function will throw.
 $waitEvent = (emitter, event) ->
   fiber = $fiber.current
+  throw new Error 'not running in a fiber' unless fiber?
 
   errorHandler = null
   handler = (args...) ->

      else
        fibre.run result
  else
    # No idea what is it, just forwards.
    return value



  (args...) ->
    fiber = $fiber.current
    throw new Error 'not running in a fiber' unless fiber?

    args.push (error, result) ->
      if error?
