Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | shianiawhite |
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!
What do you mean by “raise an error”?
Zylann | 2018-06-12 17:30
I think it’s related to the concept of exception handling, Zylann.
Ertain | 2018-06-13 06:58
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?
Zylann | 2018-06-13 12:39
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.
Ertain | 2018-06-13 16:36