Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Text error messages from some functions.  (Read 1050 times)

0 Members and 1 Guest are viewing this topic.

pauljurczak

  • Newbie
  • *
  • Posts: 3
    • View Profile
Text error messages from some functions.
« 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?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Text error messages from some functions.
« Reply #1 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 which automates a lot and also throws exceptions if loading fails.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

pauljurczak

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Text error messages from some functions.
« Reply #2 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.