monkey patch Error.prototype to add .toJSON method