Overrides method __toString in class "Exception" to provide a JSON output when the object is presented as a string.