SFML community forums

Help => General => Topic started by: pauljurczak on September 05, 2015, 11:24:50 am

Title: Text error messages from some functions.
Post by: pauljurczak on September 05, 2015, 11:24:50 am
I've built my first SFML program and I noticed that functions like loadFromFile send a text error message to the console when they fail. I can't find a description of this side effect in the documentation. Is this text being sent to std::cerr stream? Is there an option to throw an exception instead or in addition to this error message?
Title: Re: Text error messages from some functions.
Post by: Nexus on September 05, 2015, 12:14:16 pm
The error messages are sent to sf::err(), a stream which can be redirected as you like.

No, SFML doesn't throw any exceptions at the moment. To load resources like textures, sound buffers, etc., you can use Thor's Resource module (http://Thor's Resource module) which automates a lot and also throws exceptions if loading fails.
Title: Re: Text error messages from some functions.
Post by: pauljurczak on September 05, 2015, 12:49:56 pm
Thanks. I had hard time finding this before, but now your answer directed me to the description of sf::err(), which makes it clear. Maybe it could be referenced somewhere at top level of documentation as a general way of handling error conditions.