bug fix thrown php exception instead of error through (json, xml) output