From 9331ccc544f5d98ee5838041aa4366740e1cb702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20M=C3=B6ller?= Date: Thu, 28 Apr 2022 16:27:19 +0200 Subject: [PATCH] chore(warnings): add error codes to documentation site --- src/container/EdgeRenderer/MarkerSymbols.tsx | 4 +--- src/container/EdgeRenderer/index.tsx | 4 ++-- src/container/NodeRenderer/index.tsx | 2 +- src/container/ReactFlow/utils.ts | 2 +- src/hooks/useResizeHandler.ts | 2 +- src/store/utils.ts | 2 +- src/utils/graph.ts | 6 +++--- 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/container/EdgeRenderer/MarkerSymbols.tsx b/src/container/EdgeRenderer/MarkerSymbols.tsx index 94d19876..1606c124 100644 --- a/src/container/EdgeRenderer/MarkerSymbols.tsx +++ b/src/container/EdgeRenderer/MarkerSymbols.tsx @@ -39,9 +39,7 @@ export function useMarkerSymbol(type: MarkerType) { const symbolExists = MarkerSymbols.hasOwnProperty(type); if (!symbolExists) { - console.warn( - `[React Flow]: marker type "${type}" doesn't exist. Help: https://reactflow.dev/docs/guides/troubleshooting` - ); + console.warn(`[React Flow]: Marker type "${type}" doesn't exist. Help: https://reactflow.dev/error-decoder#900`); return () => null; } diff --git a/src/container/EdgeRenderer/index.tsx b/src/container/EdgeRenderer/index.tsx index 0cfc5454..05d5becf 100644 --- a/src/container/EdgeRenderer/index.tsx +++ b/src/container/EdgeRenderer/index.tsx @@ -107,14 +107,14 @@ const EdgeRenderer = (props: EdgeRendererProps) => { if (!sourceHandle) { console.warn( - `[React Flow]: couldn't create edge for source handle id: ${edge.sourceHandle}; edge id: ${edge.id}. Help: https://reactflow.dev/docs/guides/troubleshooting` + `[React Flow]: Couldn't create edge for source handle id: ${edge.sourceHandle}; edge id: ${edge.id}. Help: https://reactflow.dev/error-decoder#800` ); return null; } if (!targetHandle) { console.warn( - `[React Flow]: couldn't create edge for target handle id: ${edge.targetHandle}; edge id: ${edge.id}. Help: https://reactflow.dev/docs/guides/troubleshooting` + `[React Flow]: Couldn't create edge for target handle id: ${edge.targetHandle}; edge id: ${edge.id}. Help: https://reactflow.dev/error-decoder#800` ); return null; } diff --git a/src/container/NodeRenderer/index.tsx b/src/container/NodeRenderer/index.tsx index 10b1e2a0..b7214c1c 100644 --- a/src/container/NodeRenderer/index.tsx +++ b/src/container/NodeRenderer/index.tsx @@ -72,7 +72,7 @@ const NodeRenderer = (props: NodeRendererProps) => { if (!props.nodeTypes[nodeType]) { console.warn( - `[React Flow]: Node type "${nodeType}" not found. Using fallback type "default". Help: https://reactflow.dev/docs/guides/troubleshooting` + `[React Flow]: Node type "${nodeType}" not found. Using fallback type "default". Help: https://reactflow.dev/error-decoder#300` ); } diff --git a/src/container/ReactFlow/utils.ts b/src/container/ReactFlow/utils.ts index f6197286..2d1ebad1 100644 --- a/src/container/ReactFlow/utils.ts +++ b/src/container/ReactFlow/utils.ts @@ -16,7 +16,7 @@ export function useNodeOrEdgeTypes(nodeOrEdgeTypes: any, createTypes: any): any const typeKeys = Object.keys(nodeOrEdgeTypes); if (shallow(typesKeysRef.current, typeKeys)) { console.warn( - "[React Flow]: It looks like you have created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them. Help: https://reactflow.dev/docs/guides/troubleshooting" + "[React Flow]: It looks like you have created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them. Help: https://reactflow.dev/error-decoder#200" ); } diff --git a/src/hooks/useResizeHandler.ts b/src/hooks/useResizeHandler.ts index a9ecf40b..9f420e76 100644 --- a/src/hooks/useResizeHandler.ts +++ b/src/hooks/useResizeHandler.ts @@ -18,7 +18,7 @@ function useResizeHandler(rendererNode: MutableRefObject) if (size.height === 0 || size.width === 0) { console.warn( - '[React Flow]: The React Flow parent container needs a width and a height to render the graph. Help: https://reactflow.dev/docs/guides/troubleshooting' + '[React Flow]: The React Flow parent container needs a width and a height to render the graph. Help: https://reactflow.dev/error-decoder#400' ); } diff --git a/src/store/utils.ts b/src/store/utils.ts index 97c11e48..81b66b70 100644 --- a/src/store/utils.ts +++ b/src/store/utils.ts @@ -142,7 +142,7 @@ export function createPositionChange({ : currentExtent; } else { console.warn( - '[React Flow]: Only child nodes can use a parent extent. Help: https://reactflow.dev/docs/guides/troubleshooting' + '[React Flow]: Only child nodes can use a parent extent. Help: https://reactflow.dev/error-decoder#500' ); currentExtent = nodeExtent; } diff --git a/src/utils/graph.ts b/src/utils/graph.ts index b720d66a..8fec64eb 100644 --- a/src/utils/graph.ts +++ b/src/utils/graph.ts @@ -58,7 +58,7 @@ const connectionExists = (edge: Edge, edges: Edge[]) => { export const addEdge = (edgeParams: Edge | Connection, edges: Edge[]): Edge[] => { if (!edgeParams.source || !edgeParams.target) { console.warn( - "[React Flow]: Can't create edge. An edge needs a source and a target. Help: https://reactflow.dev/docs/guides/troubleshooting" + "[React Flow]: Can't create edge. An edge needs a source and a target. Help: https://reactflow.dev/error-decoder#600" ); return edges; } @@ -83,7 +83,7 @@ export const addEdge = (edgeParams: Edge | Connection, edges: Edge[]): Edge[] => export const updateEdge = (oldEdge: Edge, newConnection: Connection, edges: Edge[]): Edge[] => { if (!newConnection.source || !newConnection.target) { console.warn( - "[React Flow]: Can't create a new edge. An edge needs a source and a target. Help: https://reactflow.dev/docs/guides/troubleshooting" + "[React Flow]: Can't create a new edge. An edge needs a source and a target. Help: https://reactflow.dev/error-decoder#600" ); return edges; } @@ -92,7 +92,7 @@ export const updateEdge = (oldEdge: Edge, newConnection: Connection, edges: Edge if (!foundEdge) { console.warn( - `[React Flow]: The old edge with id=${oldEdge.id} does not exist. Help: https://reactflow.dev/docs/guides/troubleshooting` + `[React Flow]: The old edge with id=${oldEdge.id} does not exist. Help: https://reactflow.dev/error-decoder#700` ); return edges; }