toJSON method added to ERROR prototype