Skip to content

Unregistered/misspelled record types silently yield an empty Reflection #23

@jkalias

Description

@jkalias

Problem

GetRecordFromTypeId (src/reflection.cc:36) looks up the record with operator[]:

auto& meta_struct = instance.records[type_id];
return meta_struct;

std::map::operator[] default-inserts an empty Reflection when the key is absent, so an unregistered or misspelled type returns a record with an empty name and no members instead of signalling an error.

Impact

Operating on an unknown type produces nonsense SQL (empty table name, no columns) that fails downstream with an opaque message, instead of a clear "type not registered" error. This is also inconsistent with Database::GetRecord (src/database.cc), which uses records.at(type_id) and throws on a miss.

Suggested direction

Make the lookup consistent and fail-fast: use .at() (or an explicit find + throw) in GetRecordFromTypeId so an unregistered type raises a clear error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions