Added some error reporting (stream emit) to publisher.publish