Added class-specific exceptions to the Document class and added unit tests for this.