refactor documents to communications; add exception thrift def