Alex Kessling - Motion Wiki
  • Hello
  • ⚒️After Effects
    • ⌨️Ae-Expressions
      • ™️Branding
      • 📂Dumping Ground
      • 🏞️Secondary Animation
      • ⚖️Numbers
      • 🖨️Display Value
      • 🌈Color
      • 🐛Debugging
      • 🦸‍♀️Useful
  • 📚Learning-Motion Design
    • 🪶Tutorial Sites
  • Projects
Powered by GitBook
On this page
  1. After Effects
  2. Ae-Expressions

Debugging

throw new Error("Error is:" +Value);

Error handling in After Effects can be achieved using JavaScript and the try-catch statement. Here's an example of how you can add error handling to your code:

try {
  var path = thisComp.layer("SEG-1").content("Path 1").path;
  var trimPath = thisComp.layer("SEG-1").content("Trim Paths 1").end/100;
  var targetLayer = thisComp.layer("SEG-1");
  var point = path.pointOnPath(trimPath);

  targetLayer.toComp(Point);
} catch (e) {
  alert("An error occurred: " + e);
}

In this example, the try block contains the code that may throw an exception. The catch block will be executed if an exception is thrown, and it will display an error message with the exception message. This allows you to handle exceptions gracefully and take appropriate actions in case of errors.

PreviousColorNextUseful

Last updated 2 years ago

⚒️
⌨️
🐛