Errors & Diagnostics
Disclose DSL reports validation problems and runtime issues through Diagnostics.
Diagnostics API
import { Diagnostics } from 'disclose-dsl';
Diagnostics.on((items) => {
console.log(items);
});
Diagnostics.clear();
Each diagnostic item has:
level:errororwarnmessage: short descriptiondetail: optional extra infotime: timestamp in ms
Common Validation Messages
These are emitted while evaluating shapes and modifiers:
Arc radius must be > 0Image src is requiredPath should have at least 2 pointsBezierPath has no commandsCompound path has no subpathsText value must be a stringText lineHeight must be a number > 0Text maxWidth must be a numberText maxWidth must be > 0Fill animation requires from/toStroke width must be a number or number animation specStroke dash must be an array of numbersMove x must be [number, number]Move y must be [number, number]Curve.from must be {x,y} numbersCurve.control must be {x,y} numbersCurve.to must be {x,y} numbersVelocity x must be numberVelocity y must be numberAcceleration x must be numberAcceleration y must be numberSpring x must be [number, number]Spring y must be [number, number]Expected number or number animation specDuration must be a numberDuration must be > 0Delay must be a numberRepeat delay must be a numberColor looks invalidGradient stop position should be between 0 and 1Gradient stop position must be number or number animation specText() expects a stringText fontSize must be a number > 0Text fontFamily must be stringText fontWeight must be string or numberText fontStyle must be string
Runtime Errors
Runtime errors are normalized and reported as:
Syntax error in DSLUndefined identifier in DSL. Did you forget quotes around a string?Runtime error
If a runtime error occurs while rendering, the renderer will skip drawing that frame and store the diagnostic.