Splice KL Tips

../../_images/Splice_logo.png
Splice version 2.4.0
Copyright (c) 2010-2017 Fabric Software Inc. All rights reserved.

Reporting an error using setError

As a debugging or error reporting facility KL provides the setError statement. This can be useful for reporting errors back to the user specifically in the context of Splice. The code below for example will catch a division by zero and report that back to the user.

operator myOp(Scalar factor, Vec3 pos, io Vec3 result) {
  if(factor <= 0.0)
  {
    setError("Invalid factor specified. Please use a factor above 0.0.");
    return;
  }
  result = pos / factor;
}

This will report back this error to the host application’s console, prefixed with the Splice container and operator name.

Indices and Tables