#687 Improve exception handling in Type::getDocument()