add from_json method for error class