err.message is undefined use err instead