Better Error Handling in Example

Moved from `console.error(err)` to `console.error(err.stack)` which will produce output more inline with what one would expect in this scenario (a full stack trace).

Also I hate single line ifs that _also_ have braces, so I added newlines. If that's the standard though i can remove the whitespace.