The error a Lens script threw, for example a TypeError in one of its .js files.
Camera Kit never surfaces this error directly. It is the cause at the end of the chain behind the error you
actually receive, and which one you receive depends on when the script failed:
Before applyLens resolved. The script threw while starting up, typically in onAwake or top-level code.
applyLens rejects with a LensError and the Lens is not applied.
After applyLens resolved. The script threw while the Lens was running, typically in an event handler such
as an update, tap, or delayed callback. Camera Kit removes the Lens and emits a LensExecutionError on
the session's error event.
message is the script's error, e.g. TypeError: cannot read property 'text' of undefined.
stack lists the Lens script frames, one per line, in the same at function (file:line:column) shape browsers
use, so it renders in DevTools and error reporters. File names refer to the scripts inside the Lens project, so
they are most useful to the Lens creator.
Note: No LensScriptError is created at all if the script throws something other than an Error (a
string, a number, a plain object). JavaScript only captures a stack when an Error is constructed, so a script
that throws a bare value produces no frames — even though the script is what caused the failure.
The error a Lens script threw, for example a
TypeErrorin one of its.jsfiles.Camera Kit never surfaces this error directly. It is the
causeat the end of the chain behind the error you actually receive, and which one you receive depends on when the script failed:applyLensresolved. The script threw while starting up, typically inonAwakeor top-level code.applyLensrejects with a LensError and the Lens is not applied.applyLensresolved. The script threw while the Lens was running, typically in an event handler such as an update, tap, or delayed callback. Camera Kit removes the Lens and emits a LensExecutionError on the session'serrorevent.Use findLensScriptError to retrieve it from either.
messageis the script's error, e.g.TypeError: cannot read property 'text' of undefined.stacklists the Lens script frames, one per line, in the sameat function (file:line:column)shape browsers use, so it renders in DevTools and error reporters. File names refer to the scripts inside the Lens project, so they are most useful to the Lens creator.Note: No
LensScriptErroris created at all if the scriptthrows something other than anError(a string, a number, a plain object). JavaScript only captures a stack when anErroris constructed, so a script that throws a bare value produces no frames — even though the script is what caused the failure.