Skip to main content

Errors

Errors are thrown as JavaScript Errors whose message starts with nitro-ui-sketch:. Export methods reject their promise instead of throwing.

MessageThrown byCause
colors must be 0xRRGGBBAA integersAny API taking a colourA colour that is not an integer from 0 to 0xFFFFFFFF.
tool width must be above zerotool prop, setInkingTool, setEraserToolA width of zero, below zero, or not finite.
zoom limits must satisfy 0 < minimum <= maximumminimumZoom, maximumZoomInverted or non-positive zoom limits.
content size must be finite and not negativecontentSizeA negative or non-finite size.
viewport values must be finitesetViewportNaN or infinite zoom, x or y.
expected a Drawing created by nitro-ui-sketchdrawing prop, CanvasController.drawingAn object that is not a Drawing.
expected a Stroke created by nitro-ui-sketchremoveStroke, setSelectionAn object that is not a Stroke.
the canvas view of this controller was releasedAny CanvasController memberThe canvas was unmounted.
no canvas engine with id …CanvasController.forEngineInternal: the view's engine does not exist.
a stroke needs at least one pointaddStrokeAn empty points array.
stroke points must be finiteaddStrokeA point with a NaN or infinite value.
not a nitro-ui-sketch drawingDrawing.fromDataData that toData did not produce.
drawing data is truncatedDrawing.fromDataCut-off data.
unsupported drawing version NDrawing.fromDataData in a format version this release can't read.
export needs a rect with a positive sizetoImage, toSvg, toPdfAn empty drawing without rect, or a rect of zero size.
export scale must be above zerotoImageA scale of zero, below zero, or not finite.
export is capped at 8192 pixels on a sidetoImagerect times scale exceeds 8192 pixels.
could not allocate a GPU surface for the export, could not read the rendered pixels back, could not encode the imagetoImageThe GPU or encoder failed.
could not create the SVG exportertoSvgThe SVG writer failed.
could not create the PDF document, could not start the PDF page, could not write the PDFtoPdfThe PDF writer failed.
found no GPU to render withCanvas, exportsNo GPU device was available.