Skip to content

[Core] Add methods to retrieve available sub-items and handle not found errors in Registry and RegistryItem#12943

Merged
loumalouomega merged 5 commits intomasterfrom
core/adding-more-complete-error-message-registry
Dec 17, 2024
Merged

[Core] Add methods to retrieve available sub-items and handle not found errors in Registry and RegistryItem#12943
loumalouomega merged 5 commits intomasterfrom
core/adding-more-complete-error-message-registry

Conversation

@loumalouomega
Copy link
Member

@loumalouomega loumalouomega commented Dec 17, 2024

📝 Description

Add methods to retrieve available sub-items and handle not found errors in RegistryItem. Until now the error message when trying to retrieve an item were not meaningful, were just displating that the given name was not available, not displaying the list of potential candidates (as done in "legacy" KratosComponents). This message would be very helpful, because sometimes the problem may come from some typo of case sensitivity.

For example:

Registry::GetValue<Process>("Processes.KratosMultiphysics.output_process.Prototype"); // Instead of OutputProcess

Then:

C++ exception with description "Error: The item "Processes.KratosMultiphysics.output_process.Prototype" is not found in the registry. The item "KratosMultiphysics" does not have "output_process". The available objects are: 
                OutputProcess
                ApplyRayCastingProcess<3>
                ApplyRayCastingInterfaceRecognitionProcess<3>
                ApplyRayCastingInterfaceRecognitionProcess<2>
                ApplyRayCastingProcess<2>
                Process

Adding new tests.

🆕 Changelog

@loumalouomega loumalouomega changed the title [Core] Add methods to retrieve available sub-items and handle not found errors in RegistryItem [Core] Add methods to retrieve available sub-items and handle not found errors in Registry and RegistryItem Dec 17, 2024
Copy link
Member

@roigcarlo roigcarlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Foine

@loumalouomega loumalouomega merged commit ec51824 into master Dec 17, 2024
@loumalouomega loumalouomega deleted the core/adding-more-complete-error-message-registry branch December 17, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants