Adds Error.toJSON(), so we can easily stringify the error, for example when sending them over websockets