Skip to content

@fabwcie/free-drawing / utils/errors

utils/errors ​

Classes ​

DrawerError ​

Defined in: packages/free-drawing/src/utils/errors.ts:7

Error of the library: its text shown to users comes from key in the language of the drawer (see getErrorText), its message in English is for developers (console)

Extends

  • Error

Constructors ​

Constructor ​

new DrawerError(key, message, options?): DrawerError

Defined in: packages/free-drawing/src/utils/errors.ts:17

Create an error of the library

Parameters
key ​

"drawer.label" | "language.auto" | "toast.collaborationUnavailable" | "toast.collaborationFull" | "toast.collaborationTooBig" | "toast.canDraw" | "toast.viewOnly" | "toast.joinedViewOnly" | "toast.presentationStarted" | "toast.presentationEnded" | "toast.requestSent" | "toast.requestReceived" | "toast.requestRefused" | "toast.saveFailed" | "toast.saved" | "toast.styleCopied" | "toast.libraryImported" | "toast.libraryNotSaved" | "toast.loadFailed" | "toast.invalidFile" | "toast.linkCopied" | "toast.linkNotCopied" | "toast.invalidLink" | "toast.invalidShapeLink" | "toast.clipboardUnavailable" | "toast.exportFailed" | "toast.imageCopied" | "toast.storageCleared" | "toast.imageNotCopied" | "error.clipboardUnavailable" | "error.nothingToExport" | "error.notDrawingFile" | "error.notImage" | "error.damagedLink" | "error.drawingTooBig" | "error.imageNotCreated" | "error.serverUnreachable" | "error.notAllowed" | "error.storageFull" | "error.notLibraryFile" | "error.noDrawingInImage" | "error.insecurePage" | "error.roomKey" | "error.encryptionUnsupported" | "toast.selectionTool" | "modal.close" | "confirm.message" | "confirm.clearCanvas" | "confirm.clearStorage" | "confirm.stopCollaboration" | "confirm.leaveCollaboration" | "confirm.cancel" | "confirm.confirm" | "menu.label" | "menu.open" | "menu.saveAs" | "menu.save" | "menu.unsaved" | "menu.copyLink" | "menu.collaboration" | "menu.collaborationOn" | "menu.collaborationUsers" | "menu.export" | "menu.clearCanvas" | "menu.showGrid" | "menu.zenMode" | "menu.darkMode" | "menu.github" | "menu.githubLabel" | "menu.clearStorage" | "menu.background" | "menu.language" | "menu.commands" | "menu.preferences" | "preferences.title" | "preferences.autoSave" | "preferences.shapeRecognition" | "grid.style" | "grid.squares" | "grid.dots" | "grid.lines" | "grid.isometric" | "grid.styleCommand" | "preferences.wheel" | "wheel.zoom" | "wheel.pan" | "wheel.command" | "help.spaceDrag" | "help.wheelDrag" | "preferences.save" | "preferences.appearance" | "preferences.theme" | "preferences.light" | "preferences.dark" | "preferences.system" | "preferences.drawing" | "commands.search" | "commands.empty" | "commands.file" | "commands.language" | "color.white" | "color.lightGray" | "color.lightBlue" | "color.lightYellow" | "color.lightBeige" | "color.lightRed" | "color.lightGreen" | "color.black" | "color.red" | "color.green" | "color.blue" | "color.orange" | "color.yellow" | "color.pink" | "color.transparent" | "color.custom" | "color.pick" | "help.title" | "help.documentation" | "help.issue" | "help.shortcuts" | "help.tools" | "help.editor" | "help.view" | "help.or" | "help.selectAll" | "help.deleteSelection" | "help.duplicate" | "help.group" | "help.selectInGroup" | "help.constrainDrawing" | "help.whileDrawing" | "help.cancelDrawing" | "help.arrowUnlinked" | "help.constrainSelection" | "help.whileTransforming" | "help.move" | "help.forwardBackward" | "help.frontBack" | "help.lock" | "help.paste" | "help.open" | "help.save" | "help.export" | "help.grid" | "help.layers" | "help.layersSelect" | "help.snap" | "help.zoom" | "help.toolsConstrain" | "key.delete" | "key.arrows" | "key.click" | "key.space" | "key.wheel" | "key.ctrl" | "key.shift" | "key.alt" | "key.escape" | "key.enter" | "key.tab" | "key.home" | "key.end" | "key.backspace" | "toolbar.label" | "toolbar.moreTools" | "toolbar.keepTool" | "tools.pan" | "tools.selection" | "tools.brush" | "tools.eraser" | "tools.text" | "tools.note" | "tools.line" | "tools.square" | "tools.circle" | "tools.arrow" | "tools.image" | "tools.triangle" | "tools.diamond" | "tools.laser" | "tools.frame" | "zoom.label" | "zoom.out" | "zoom.in" | "zoom.reset" | "zoom.fit" | "zoom.selection" | "zoom.to100" | "history.label" | "history.undo" | "history.redo" | "position.label" | "position.recenter" | "context.paste" | "context.snap" | "context.lock" | "context.unlock" | "selectionMenu.label" | "action.duplicate" | "action.copyStyle" | "action.pasteStyle" | "library.title" | "library.add" | "library.empty" | "library.hint" | "library.insert" | "library.remove" | "library.import" | "library.export" | "library.close" | "library.shapes" | "search.label" | "search.count" | "search.none" | "slideshow.start" | "slideshow.presentFrom" | "slideshow.label" | "slideshow.previous" | "slideshow.next" | "slideshow.stop" | "slideshow.count" | "slideshow.slide" | "slideshow.slideTitled" | "slideshow.noFrames" | "slideshow.nextPrevious" | "slideshow.firstLast" | "slideshow.whilePresenting" | "replay.start" | "replay.label" | "replay.play" | "replay.pause" | "replay.restart" | "replay.speed" | "replay.stop" | "replay.count" | "replay.empty" | "replay.finished" | "replay.playPause" | "replay.step" | "replay.firstLast" | "replay.whileReplaying" | "navigation.description" | "navigation.text" | "navigation.shapes" | "navigation.from" | "navigation.to" | "navigation.link" | "navigation.locked" | "navigation.in" | "navigation.index" | "navigation.left" | "navigation.nextPrevious" | "navigation.enter" | "navigation.parent" | "navigation.leave" | "navigation.onDrawing" | "search.previous" | "search.next" | "search.close" | "action.group" | "action.ungroup" | "action.sendToBack" | "action.sendBackward" | "action.bringForward" | "action.bringToFront" | "action.delete" | "action.rotateRight" | "action.rotateLeft" | "action.flipHorizontal" | "action.flipVertical" | "action.insertImage" | "toast.imageFailed" | "action.alignLeft" | "action.alignCenter" | "action.alignRight" | "action.alignTop" | "action.alignMiddle" | "action.alignBottom" | "action.distributeHorizontal" | "action.distributeVertical" | "action.stackHorizontal" | "action.stackVertical" | "action.fitTextWidth" | "action.copyPng" | "action.copySvg" | "action.link" | "overlay.tool" | "overlay.selection" | "overlay.shape" | "overlay.brush" | "overlay.recognizeShapes" | "overlay.recognizeShapesHint" | "overlay.note" | "overlay.text" | "overlay.stroke" | "overlay.color" | "overlay.background" | "overlay.strokeWidth" | "overlay.strokeStyle" | "overlay.edges" | "overlay.arrowType" | "overlay.startHead" | "overlay.endHead" | "overlay.opacity" | "overlay.layers" | "overlay.align" | "overlay.distribute" | "overlay.actions" | "link.address" | "link.placeholder" | "link.open" | "link.remove" | "width.thin" | "width.medium" | "width.thick" | "width.extraThick" | "style.solid" | "style.dashed" | "style.dotted" | "edges.sharp" | "edges.round" | "edges.radius" | "edges.auto" | "arrow.straight" | "arrow.curved" | "arrow.elbow" | "arrowhead.none" | "arrowhead.arrow" | "arrowhead.triangle" | "arrowhead.dot" | "arrowhead.bar" | "text.fontFamily" | "text.fontSize" | "text.small" | "text.medium" | "text.large" | "text.extraLarge" | "text.style" | "text.bold" | "text.italic" | "text.underline" | "text.strikethrough" | "text.align" | "text.alignLeft" | "text.alignCenter" | "text.alignRight" | "layers.title" | "layers.group" | "layers.close" | "layers.empty" | "layers.drag" | "layers.shapesOf" | "layers.hide" | "layers.lock" | "layers.delete" | "layers.name" | "layers.toggle" | "layers.range" | "shapes.freehand" | "shapes.line" | "shapes.rect" | "shapes.ellipse" | "shapes.arrow" | "shapes.triangle" | "shapes.diamond" | "shapes.heart" | "shapes.cloud" | "shapes.star" | "shapes.hexagon" | "shapes.blockArrow" | "shapes.bubble" | "shapes.checkbox" | "shapes.shape" | "shapes.highlighter" | "shapes.frame" | "shapes.frameName" | "shapes.text" | "shapes.note" | "shapes.group" | "shapes.image" | "export.title" | "export.empty" | "export.options" | "export.selected" | "export.background" | "export.dark" | "export.withDrawing" | "export.scale" | "export.saveAs" | "export.saveFile" | "export.copy" | "export.preview" | "collab.title" | "collab.intro" | "collab.introInvited" | "collab.introJoined" | "collab.introJoinedOf" | "collab.name" | "collab.anonymous" | "collab.link" | "collab.copy" | "collab.qrCode" | "collab.start" | "collab.join" | "collab.stop" | "collab.leave" | "collab.live" | "collab.liveState" | "collab.connected" | "collab.connecting" | "collab.you" | "collab.invitedBy" | "collab.canDrawLabel" | "collab.canDraw" | "collab.newUsersCanDraw" | "collab.encrypted" | "collab.notEncrypted" | "collab.owner" | "collab.viewOnly" | "collab.present" | "collab.presenting" | "collab.follow" | "collab.followPresentation" | "collab.following" | "collab.youCanDraw" | "collab.youViewOnly" | "collab.requestEdit" | "collab.requestSent" | "collab.requests" | "collab.requestsCount" | "collab.accept" | "collab.refuse" | "collab.acceptLabel" | "collab.refuseLabel" | "collab.users" | "collab.settings"

Key of its text shown to users

message ​

string

Message in English, for developers

options? ​

ErrorOptions

Cause of the error (error of the browser or of a server)

Returns

DrawerError

Overrides

Error.constructor

Properties ​

key ​

readonly key: "drawer.label" | "language.auto" | "toast.collaborationUnavailable" | "toast.collaborationFull" | "toast.collaborationTooBig" | "toast.canDraw" | "toast.viewOnly" | "toast.joinedViewOnly" | "toast.presentationStarted" | "toast.presentationEnded" | "toast.requestSent" | "toast.requestReceived" | "toast.requestRefused" | "toast.saveFailed" | "toast.saved" | "toast.styleCopied" | "toast.libraryImported" | "toast.libraryNotSaved" | "toast.loadFailed" | "toast.invalidFile" | "toast.linkCopied" | "toast.linkNotCopied" | "toast.invalidLink" | "toast.invalidShapeLink" | "toast.clipboardUnavailable" | "toast.exportFailed" | "toast.imageCopied" | "toast.storageCleared" | "toast.imageNotCopied" | "error.clipboardUnavailable" | "error.nothingToExport" | "error.notDrawingFile" | "error.notImage" | "error.damagedLink" | "error.drawingTooBig" | "error.imageNotCreated" | "error.serverUnreachable" | "error.notAllowed" | "error.storageFull" | "error.notLibraryFile" | "error.noDrawingInImage" | "error.insecurePage" | "error.roomKey" | "error.encryptionUnsupported" | "toast.selectionTool" | "modal.close" | "confirm.message" | "confirm.clearCanvas" | "confirm.clearStorage" | "confirm.stopCollaboration" | "confirm.leaveCollaboration" | "confirm.cancel" | "confirm.confirm" | "menu.label" | "menu.open" | "menu.saveAs" | "menu.save" | "menu.unsaved" | "menu.copyLink" | "menu.collaboration" | "menu.collaborationOn" | "menu.collaborationUsers" | "menu.export" | "menu.clearCanvas" | "menu.showGrid" | "menu.zenMode" | "menu.darkMode" | "menu.github" | "menu.githubLabel" | "menu.clearStorage" | "menu.background" | "menu.language" | "menu.commands" | "menu.preferences" | "preferences.title" | "preferences.autoSave" | "preferences.shapeRecognition" | "grid.style" | "grid.squares" | "grid.dots" | "grid.lines" | "grid.isometric" | "grid.styleCommand" | "preferences.wheel" | "wheel.zoom" | "wheel.pan" | "wheel.command" | "help.spaceDrag" | "help.wheelDrag" | "preferences.save" | "preferences.appearance" | "preferences.theme" | "preferences.light" | "preferences.dark" | "preferences.system" | "preferences.drawing" | "commands.search" | "commands.empty" | "commands.file" | "commands.language" | "color.white" | "color.lightGray" | "color.lightBlue" | "color.lightYellow" | "color.lightBeige" | "color.lightRed" | "color.lightGreen" | "color.black" | "color.red" | "color.green" | "color.blue" | "color.orange" | "color.yellow" | "color.pink" | "color.transparent" | "color.custom" | "color.pick" | "help.title" | "help.documentation" | "help.issue" | "help.shortcuts" | "help.tools" | "help.editor" | "help.view" | "help.or" | "help.selectAll" | "help.deleteSelection" | "help.duplicate" | "help.group" | "help.selectInGroup" | "help.constrainDrawing" | "help.whileDrawing" | "help.cancelDrawing" | "help.arrowUnlinked" | "help.constrainSelection" | "help.whileTransforming" | "help.move" | "help.forwardBackward" | "help.frontBack" | "help.lock" | "help.paste" | "help.open" | "help.save" | "help.export" | "help.grid" | "help.layers" | "help.layersSelect" | "help.snap" | "help.zoom" | "help.toolsConstrain" | "key.delete" | "key.arrows" | "key.click" | "key.space" | "key.wheel" | "key.ctrl" | "key.shift" | "key.alt" | "key.escape" | "key.enter" | "key.tab" | "key.home" | "key.end" | "key.backspace" | "toolbar.label" | "toolbar.moreTools" | "toolbar.keepTool" | "tools.pan" | "tools.selection" | "tools.brush" | "tools.eraser" | "tools.text" | "tools.note" | "tools.line" | "tools.square" | "tools.circle" | "tools.arrow" | "tools.image" | "tools.triangle" | "tools.diamond" | "tools.laser" | "tools.frame" | "zoom.label" | "zoom.out" | "zoom.in" | "zoom.reset" | "zoom.fit" | "zoom.selection" | "zoom.to100" | "history.label" | "history.undo" | "history.redo" | "position.label" | "position.recenter" | "context.paste" | "context.snap" | "context.lock" | "context.unlock" | "selectionMenu.label" | "action.duplicate" | "action.copyStyle" | "action.pasteStyle" | "library.title" | "library.add" | "library.empty" | "library.hint" | "library.insert" | "library.remove" | "library.import" | "library.export" | "library.close" | "library.shapes" | "search.label" | "search.count" | "search.none" | "slideshow.start" | "slideshow.presentFrom" | "slideshow.label" | "slideshow.previous" | "slideshow.next" | "slideshow.stop" | "slideshow.count" | "slideshow.slide" | "slideshow.slideTitled" | "slideshow.noFrames" | "slideshow.nextPrevious" | "slideshow.firstLast" | "slideshow.whilePresenting" | "replay.start" | "replay.label" | "replay.play" | "replay.pause" | "replay.restart" | "replay.speed" | "replay.stop" | "replay.count" | "replay.empty" | "replay.finished" | "replay.playPause" | "replay.step" | "replay.firstLast" | "replay.whileReplaying" | "navigation.description" | "navigation.text" | "navigation.shapes" | "navigation.from" | "navigation.to" | "navigation.link" | "navigation.locked" | "navigation.in" | "navigation.index" | "navigation.left" | "navigation.nextPrevious" | "navigation.enter" | "navigation.parent" | "navigation.leave" | "navigation.onDrawing" | "search.previous" | "search.next" | "search.close" | "action.group" | "action.ungroup" | "action.sendToBack" | "action.sendBackward" | "action.bringForward" | "action.bringToFront" | "action.delete" | "action.rotateRight" | "action.rotateLeft" | "action.flipHorizontal" | "action.flipVertical" | "action.insertImage" | "toast.imageFailed" | "action.alignLeft" | "action.alignCenter" | "action.alignRight" | "action.alignTop" | "action.alignMiddle" | "action.alignBottom" | "action.distributeHorizontal" | "action.distributeVertical" | "action.stackHorizontal" | "action.stackVertical" | "action.fitTextWidth" | "action.copyPng" | "action.copySvg" | "action.link" | "overlay.tool" | "overlay.selection" | "overlay.shape" | "overlay.brush" | "overlay.recognizeShapes" | "overlay.recognizeShapesHint" | "overlay.note" | "overlay.text" | "overlay.stroke" | "overlay.color" | "overlay.background" | "overlay.strokeWidth" | "overlay.strokeStyle" | "overlay.edges" | "overlay.arrowType" | "overlay.startHead" | "overlay.endHead" | "overlay.opacity" | "overlay.layers" | "overlay.align" | "overlay.distribute" | "overlay.actions" | "link.address" | "link.placeholder" | "link.open" | "link.remove" | "width.thin" | "width.medium" | "width.thick" | "width.extraThick" | "style.solid" | "style.dashed" | "style.dotted" | "edges.sharp" | "edges.round" | "edges.radius" | "edges.auto" | "arrow.straight" | "arrow.curved" | "arrow.elbow" | "arrowhead.none" | "arrowhead.arrow" | "arrowhead.triangle" | "arrowhead.dot" | "arrowhead.bar" | "text.fontFamily" | "text.fontSize" | "text.small" | "text.medium" | "text.large" | "text.extraLarge" | "text.style" | "text.bold" | "text.italic" | "text.underline" | "text.strikethrough" | "text.align" | "text.alignLeft" | "text.alignCenter" | "text.alignRight" | "layers.title" | "layers.group" | "layers.close" | "layers.empty" | "layers.drag" | "layers.shapesOf" | "layers.hide" | "layers.lock" | "layers.delete" | "layers.name" | "layers.toggle" | "layers.range" | "shapes.freehand" | "shapes.line" | "shapes.rect" | "shapes.ellipse" | "shapes.arrow" | "shapes.triangle" | "shapes.diamond" | "shapes.heart" | "shapes.cloud" | "shapes.star" | "shapes.hexagon" | "shapes.blockArrow" | "shapes.bubble" | "shapes.checkbox" | "shapes.shape" | "shapes.highlighter" | "shapes.frame" | "shapes.frameName" | "shapes.text" | "shapes.note" | "shapes.group" | "shapes.image" | "export.title" | "export.empty" | "export.options" | "export.selected" | "export.background" | "export.dark" | "export.withDrawing" | "export.scale" | "export.saveAs" | "export.saveFile" | "export.copy" | "export.preview" | "collab.title" | "collab.intro" | "collab.introInvited" | "collab.introJoined" | "collab.introJoinedOf" | "collab.name" | "collab.anonymous" | "collab.link" | "collab.copy" | "collab.qrCode" | "collab.start" | "collab.join" | "collab.stop" | "collab.leave" | "collab.live" | "collab.liveState" | "collab.connected" | "collab.connecting" | "collab.you" | "collab.invitedBy" | "collab.canDrawLabel" | "collab.canDraw" | "collab.newUsersCanDraw" | "collab.encrypted" | "collab.notEncrypted" | "collab.owner" | "collab.viewOnly" | "collab.present" | "collab.presenting" | "collab.follow" | "collab.followPresentation" | "collab.following" | "collab.youCanDraw" | "collab.youViewOnly" | "collab.requestEdit" | "collab.requestSent" | "collab.requests" | "collab.requestsCount" | "collab.accept" | "collab.refuse" | "collab.acceptLabel" | "collab.refuseLabel" | "collab.users" | "collab.settings"

Defined in: packages/free-drawing/src/utils/errors.ts:9

Key of the text of the error in the language of the drawer

Functions ​

getErrorText() ​

getErrorText(error, t): string

Defined in: packages/free-drawing/src/utils/errors.ts:38

Text of an error shown after the text of a toast, in the language of the drawer: errors of the library and known errors of the browser translated, else the message of the error (server, app: already in the language of the user)

Parameters

error

unknown

Error caught

t

Translate

Translation function of the drawer

Returns

string

Text of the error