0 votes

Another question already asked about raising an error, but their question was really asking how to stop the debugger at a given point. And so the answer addressed that real question rather than how to raise an error (additionally, the question is a few years old now and may hav changed). Is there a way to actually raise an error? Preferably passing an error message? Thank you!

asked Jun 12 in Engine by shianiawhite (75 points)

What do you mean by "raise an error"?

I think it's related to the concept of exception handling, Zylann.

Godot doesn't suppot exceptions, at least not like common languages do it. It only has asserts or error prints. Is it about the latter?

I think it's about printing an error. Or more of, when the program is executing, the programmer would like to handle an error the best way they can. For example, what I usually do when I can catch an error, I use the following:

if (foo != "bar"):
    print("It's not a foobar!")
    get_tree().quit()

I hope that clears things up.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.