use common `emitErr` function
add semicolon
emit err only if truthy