Error handling for custom values

Moderators: Disciple, zlovatt

Post Reply
dfred
Posts: 29
Joined: July 23rd, 2010, 11:49 pm

I have an animated mask path on layer 1 and I am trying to handle an "After Effects error" with the following expression in source text:

Code: Select all

try {
x = thisComp.layer(1).mask(1).maskPath.velocity;
}
catch (err) {
x = "error";
}
The error I keep getting is:
After Effects error: can't compute derivative to a non-spatial custom value ( 29 :: 57 )
The try/catch statement doesn't seem to work in this case for some reason. Any ideas on how to handle this error?
dfred
Posts: 29
Joined: July 23rd, 2010, 11:49 pm

Apparently it's unable to be handled. According to the JavaScript Tools Guide:
Messaging error codes
Negative values indicate unrecoverable errors...
-29 Uncaught exception
57 Cannot resolve reference
So, I came up with this ugly solution:

Code: Select all

maskPath = thisComp.layer(1).mask(1).maskPath;
try {
    if (maskPath.numKeys > 0){
        throw ("err1");
    } else {
        x = maskPath.velocity;
    }
}
catch (err) {
    x = "error";
}
I would much rather have a way to read through expressions:

Code: Select all

maskPath.propertyValueType.CUSTOM_VALUE == true
I guess I'll have to do it through scripting for now. So, let me know if anybody has a better solution.
Post Reply