• 12
• 12
• 9
• 10
• 13

# Getting rid of Angelscript prints

This topic is 1602 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello!

I want to do my own error handling for when Angelscript functions fail. In most cases this is really easy by just checking the return value. However it seems like there is one case where I am getting an error print from Angelscript when I would rather want to take care of it myself. Here is the code in question:

asIObjectType* ScriptModule::getObjectTypeByDecl(const std::string& decl)
{
std::cout << "Type declaration: " << decl << "\n";
auto id = mAsModule->GetTypeIdByDecl(decl.c_str());
std::cout << "Id: " << id << "\n";

if(id < 0)
{
std::cout << "Returning null!\n";
return nullptr;
}

auto thing = mEngine.getEngine()->GetObjectTypeById(id);
std::cout << "Thing is: " << thing << "\n";

return thing;
}


If I provide this function with a type that does not exist, "Elphant" instead of "Elephant" for instance, I get the following output:

Type declaration: Elphant
(1, 1) : error : Identifier 'Elphant' is not a data type
Id: -12
Returning null!

So it seems like everything works as expected, except that the function not only returns -12 as the error, but also gives this debug print which is unwanted. Is there a particular reason for this? Am I doing it the wrong way? If not, can I get rid of the print somehow?

##### Share on other sites
This is a mistake. The library should not write any message to the application in this case. I'll have it fixed as soon as I can.

##### Share on other sites

Ah, alright. Take your time. :)

##### Share on other sites

I've corrected this mistake in revision 1761.

Thanks,

Andreas