node: check if `er` is undefined

Throwing `undefined` causes segmentation fault when uncaught.

That works in 0.10.22 but was broken with c16963b977b3cede4cef476c275226a513831407.