Add global error listener.

Closes #31.

@dnkoutso