Skip to content

Commit 2e52000

Browse files
committed
factory.cpp: include authority name in exception
1 parent 28e35de commit 2e52000

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

src/iso19111/factory.cpp

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4200,10 +4200,11 @@ AuthorityFactory::createObject(const std::string &code) const {
42004200

42014201
//! @cond Doxygen_Suppress
42024202
static FactoryException buildFactoryException(const char *type,
4203+
const std::string &authName,
42034204
const std::string &code,
42044205
const std::exception &ex) {
4205-
return FactoryException(std::string("cannot build ") + type + " " + code +
4206-
": " + ex.what());
4206+
return FactoryException(std::string("cannot build ") + type + " " +
4207+
authName + ":" + code + ": " + ex.what());
42074208
}
42084209
//! @endcond
42094210

@@ -4258,7 +4259,7 @@ AuthorityFactory::createExtent(const std::string &code) const {
42584259
return extent;
42594260

42604261
} catch (const std::exception &ex) {
4261-
throw buildFactoryException("extent", code, ex);
4262+
throw buildFactoryException("extent", d->authority(), code, ex);
42624263
}
42634264
}
42644265

@@ -4323,7 +4324,8 @@ AuthorityFactory::createUnitOfMeasure(const std::string &code) const {
43234324
d->context()->d->cache(cacheKey, uom);
43244325
return uom;
43254326
} catch (const std::exception &ex) {
4326-
throw buildFactoryException("unit of measure", code, ex);
4327+
throw buildFactoryException("unit of measure", d->authority(), code,
4328+
ex);
43274329
}
43284330
}
43294331

@@ -4410,7 +4412,7 @@ AuthorityFactory::createPrimeMeridian(const std::string &code) const {
44104412
d->context()->d->cache(cacheKey, pm);
44114413
return pm;
44124414
} catch (const std::exception &ex) {
4413-
throw buildFactoryException("prime meridian", code, ex);
4415+
throw buildFactoryException("prime meridian", d->authority(), code, ex);
44144416
}
44154417
}
44164418

@@ -4509,7 +4511,7 @@ AuthorityFactory::createEllipsoid(const std::string &code) const {
45094511
return ellps;
45104512
}
45114513
} catch (const std::exception &ex) {
4512-
throw buildFactoryException("ellipsoid", code, ex);
4514+
throw buildFactoryException("ellipsoid", d->authority(), code, ex);
45134515
}
45144516
}
45154517

@@ -4634,7 +4636,8 @@ void AuthorityFactory::createGeodeticDatumOrEnsemble(
46344636
outDatum = datum.as_nullable();
46354637
}
46364638
} catch (const std::exception &ex) {
4637-
throw buildFactoryException("geodetic reference frame", code, ex);
4639+
throw buildFactoryException("geodetic reference frame", d->authority(),
4640+
code, ex);
46384641
}
46394642
}
46404643

@@ -4727,7 +4730,8 @@ void AuthorityFactory::createVerticalDatumOrEnsemble(
47274730
}
47284731
}
47294732
} catch (const std::exception &ex) {
4730-
throw buildFactoryException("vertical reference frame", code, ex);
4733+
throw buildFactoryException("vertical reference frame", d->authority(),
4734+
code, ex);
47314735
}
47324736
}
47334737

@@ -5131,7 +5135,7 @@ AuthorityFactory::createGeodeticCRS(const std::string &code,
51315135
throw FactoryException("unsupported (type, CS type) for geodeticCRS: " +
51325136
type + ", " + cs->getWKT2Type(true));
51335137
} catch (const std::exception &ex) {
5134-
throw buildFactoryException("geodeticCRS", code, ex);
5138+
throw buildFactoryException("geodeticCRS", d->authority(), code, ex);
51355139
}
51365140
}
51375141

@@ -5196,7 +5200,7 @@ AuthorityFactory::createVerticalCRS(const std::string &code) const {
51965200
throw FactoryException("unsupported CS type for verticalCRS: " +
51975201
cs->getWKT2Type(true));
51985202
} catch (const std::exception &ex) {
5199-
throw buildFactoryException("verticalCRS", code, ex);
5203+
throw buildFactoryException("verticalCRS", d->authority(), code, ex);
52005204
}
52015205
}
52025206

@@ -5312,7 +5316,7 @@ AuthorityFactory::createConversion(const std::string &code) const {
53125316
return operation::Conversion::create(propConversion, propMethod,
53135317
parameters, values);
53145318
} catch (const std::exception &ex) {
5315-
throw buildFactoryException("conversion", code, ex);
5319+
throw buildFactoryException("conversion", d->authority(), code, ex);
53165320
}
53175321
}
53185322

@@ -5450,7 +5454,7 @@ AuthorityFactory::Private::createProjectedCRSEnd(const std::string &code,
54505454
throw FactoryException("unsupported CS type for projectedCRS: " +
54515455
cs->getWKT2Type(true));
54525456
} catch (const std::exception &ex) {
5453-
throw buildFactoryException("projectedCRS", code, ex);
5457+
throw buildFactoryException("projectedCRS", authority(), code, ex);
54545458
}
54555459
}
54565460
//! @endcond
@@ -5497,7 +5501,7 @@ AuthorityFactory::createCompoundCRS(const std::string &code) const {
54975501
return crs::CompoundCRS::create(
54985502
props, std::vector<crs::CRSNNPtr>{horizCRS, vertCRS});
54995503
} catch (const std::exception &ex) {
5500-
throw buildFactoryException("compoundCRS", code, ex);
5504+
throw buildFactoryException("compoundCRS", d->authority(), code, ex);
55015505
}
55025506
}
55035507

@@ -5935,7 +5939,8 @@ operation::CoordinateOperationNNPtr AuthorityFactory::createCoordinateOperation(
59355939
values, accuracies);
59365940

59375941
} catch (const std::exception &ex) {
5938-
throw buildFactoryException("transformation", code, ex);
5942+
throw buildFactoryException("transformation", d->authority(), code,
5943+
ex);
59395944
}
59405945
}
59415946

@@ -6050,7 +6055,8 @@ operation::CoordinateOperationNNPtr AuthorityFactory::createCoordinateOperation(
60506055
return transf;
60516056

60526057
} catch (const std::exception &ex) {
6053-
throw buildFactoryException("transformation", code, ex);
6058+
throw buildFactoryException("transformation", d->authority(), code,
6059+
ex);
60546060
}
60556061
}
60566062

@@ -6202,7 +6208,8 @@ operation::CoordinateOperationNNPtr AuthorityFactory::createCoordinateOperation(
62026208
parameters, values, accuracies);
62036209

62046210
} catch (const std::exception &ex) {
6205-
throw buildFactoryException("transformation", code, ex);
6211+
throw buildFactoryException("transformation", d->authority(), code,
6212+
ex);
62066213
}
62076214
}
62086215

@@ -6306,7 +6313,8 @@ operation::CoordinateOperationNNPtr AuthorityFactory::createCoordinateOperation(
63066313
accuracies);
63076314

63086315
} catch (const std::exception &ex) {
6309-
throw buildFactoryException("transformation", code, ex);
6316+
throw buildFactoryException("transformation", d->authority(), code,
6317+
ex);
63106318
}
63116319
}
63126320

0 commit comments

Comments
 (0)