[lib] Fix encoding type.

- Needed for node.js 0.10.x.
[lib] Add exception info to error.

- This is not as good as a full stack trace but should help debugging.