Change emit to emit_error in error callback