mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
catch errors during iterator construction
This commit is contained in:
@@ -87,7 +87,12 @@ namespace IfcGeom {
|
|||||||
: file_(file)
|
: file_(file)
|
||||||
, settings_(settings)
|
, settings_(settings)
|
||||||
{
|
{
|
||||||
implementation_ = iterator_implementations<P, PP>().construct(file_->schema()->name(), settings, file, filters_, num_threads);
|
try {
|
||||||
|
implementation_ = iterator_implementations<P, PP>().construct(file_->schema()->name(), settings, file, filters_, num_threads);
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
Logger::Error(e);
|
||||||
|
implementation_ = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, size_t num_threads = 1)
|
Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, size_t num_threads = 1)
|
||||||
@@ -95,11 +100,20 @@ namespace IfcGeom {
|
|||||||
, settings_(settings)
|
, settings_(settings)
|
||||||
, filters_(filters)
|
, filters_(filters)
|
||||||
{
|
{
|
||||||
implementation_ = iterator_implementations<P, PP>().construct(file_->schema()->name(), settings, file, filters_, num_threads);
|
try {
|
||||||
|
implementation_ = iterator_implementations<P, PP>().construct(file_->schema()->name(), settings, file, filters_, num_threads);
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
Logger::Error(e);
|
||||||
|
implementation_ = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool initialize() {
|
bool initialize() {
|
||||||
return implementation_->initialize();
|
if (implementation_) {
|
||||||
|
return implementation_->initialize();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int progress() const { return implementation_->progress(); }
|
int progress() const { return implementation_->progress(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user