Skip to content

Commit daac353

Browse files
committed
Amend error message so it also mentions new process_untagged_* funcs
1 parent bc87ea2 commit daac353

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/output-flex.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,10 @@ void output_flex_t::check_context_and_state(char const *name,
305305
char const *context, bool condition)
306306
{
307307
if (condition) {
308-
throw fmt_error("The function {}() can only be called from the {}.",
309-
name, context);
308+
throw fmt_error(
309+
"The function {}() can only be called (directly or indirectly) "
310+
"from the process_[untagged]_{}() functions.",
311+
name, context);
310312
}
311313

312314
if (lua_gettop(lua_state()) > 1) {
@@ -317,7 +319,7 @@ void output_flex_t::check_context_and_state(char const *name,
317319
int output_flex_t::app_get_bbox()
318320
{
319321
check_context_and_state(
320-
"get_bbox", "process_node/way/relation() functions",
322+
"get_bbox", "node/way/relation",
321323
m_calling_context != calling_context::process_node &&
322324
m_calling_context != calling_context::process_way &&
323325
m_calling_context != calling_context::process_relation);
@@ -367,7 +369,7 @@ int output_flex_t::app_get_bbox()
367369

368370
int output_flex_t::app_as_point()
369371
{
370-
check_context_and_state("as_point", "process_node() function",
372+
check_context_and_state("as_point", "node",
371373
m_calling_context != calling_context::process_node);
372374

373375
auto *geom = create_lua_geometry_object(lua_state());
@@ -378,7 +380,7 @@ int output_flex_t::app_as_point()
378380

379381
int output_flex_t::app_as_linestring()
380382
{
381-
check_context_and_state("as_linestring", "process_way() function",
383+
check_context_and_state("as_linestring", "way",
382384
m_calling_context != calling_context::process_way);
383385

384386
m_way_cache.add_nodes(middle());
@@ -391,7 +393,7 @@ int output_flex_t::app_as_linestring()
391393

392394
int output_flex_t::app_as_polygon()
393395
{
394-
check_context_and_state("as_polygon", "process_way() function",
396+
check_context_and_state("as_polygon", "way",
395397
m_calling_context != calling_context::process_way);
396398

397399
m_way_cache.add_nodes(middle());
@@ -405,7 +407,7 @@ int output_flex_t::app_as_polygon()
405407
int output_flex_t::app_as_multipoint()
406408
{
407409
check_context_and_state(
408-
"as_multipoint", "process_node/relation() functions",
410+
"as_multipoint", "node/relation",
409411
m_calling_context != calling_context::process_node &&
410412
m_calling_context != calling_context::process_relation);
411413

@@ -423,10 +425,10 @@ int output_flex_t::app_as_multipoint()
423425

424426
int output_flex_t::app_as_multilinestring()
425427
{
426-
check_context_and_state(
427-
"as_multilinestring", "process_way/relation() functions",
428-
m_calling_context != calling_context::process_way &&
429-
m_calling_context != calling_context::process_relation);
428+
check_context_and_state("as_multilinestring", "way/relation",
429+
m_calling_context != calling_context::process_way &&
430+
m_calling_context !=
431+
calling_context::process_relation);
430432

431433
if (m_calling_context == calling_context::process_way) {
432434
m_way_cache.add_nodes(middle());
@@ -447,10 +449,10 @@ int output_flex_t::app_as_multilinestring()
447449

448450
int output_flex_t::app_as_multipolygon()
449451
{
450-
check_context_and_state(
451-
"as_multipolygon", "process_way/relation() functions",
452-
m_calling_context != calling_context::process_way &&
453-
m_calling_context != calling_context::process_relation);
452+
check_context_and_state("as_multipolygon", "way/relation",
453+
m_calling_context != calling_context::process_way &&
454+
m_calling_context !=
455+
calling_context::process_relation);
454456

455457
if (m_calling_context == calling_context::process_way) {
456458
m_way_cache.add_nodes(middle());
@@ -473,9 +475,9 @@ int output_flex_t::app_as_multipolygon()
473475

474476
int output_flex_t::app_as_geometrycollection()
475477
{
476-
check_context_and_state(
477-
"as_geometrycollection", "process_relation() function",
478-
m_calling_context != calling_context::process_relation);
478+
check_context_and_state("as_geometrycollection", "relation",
479+
m_calling_context !=
480+
calling_context::process_relation);
479481

480482
m_relation_cache.add_members(middle());
481483

0 commit comments

Comments
 (0)