4

In Asymptote programming, how to throw an error? I tried error("message") but the argument of the error function is a file, not a string.

1 Answer 1

5

There is an assert command that might work for you. void assert(bool b, string s="");

So the following code: assert(false, "My Error Message");

Will abort execution with the following statement at the command line. assert FAILED: My Error Message

There's also void exit(); that exits with a zero error return code.

And void abort(string s="") returns a non-zero code and prints the string.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .