Clearer error messages instead of 'assertion failed' for RTTI errors


#1

Hi there,

It has occurred to me that you often get an ‘assertion failed’ error before initialisation, at some line in the cpp code of nap, when something is wrong with rtti definitions.

For example, when you forget to add RTTI_ENABLE() to an rtti defined class, you get:

Assertion failed: (component_instance), function createEntityInstance, file /Users/macbook/Documents/Repositories/nap/modules/napscene/src/scene.cpp, line 522.

These errors are hard to debug, because they give no additional information about the type of problem or about which class causes it.

I was wondering if it would be possible to create clearer error messages for these cases, that communicate the cause and the location of the problem to the programmer.

Greetings,
Casimir


#2

Hey, sorry for the late reply on this one. I agree that better error messages as a result of serialization errors due to definition (or other) failures are important. That said: the assert is there for a reason because it’s simply not allowed to fail. I think we need to introduce a special assert that prints a message before throwing the assert, this will resolve your issue. I’ll make a ticket for it.