better error messages
This commit is contained in:
parent
5d95e99e63
commit
db246ccefe
2 changed files with 5 additions and 5 deletions
|
|
@ -645,7 +645,7 @@ export function ArrowSVG(props: {arrow: Arrow, selected: string[], errors: strin
|
||||||
data-parts="start end"
|
data-parts="start end"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{props.errors.length>0 && <text className="error" x={(start.x+end.x)/2} y={(start.y+end.y)/2} data-uid={uid} data-parts="start end">{props.errors.join(' ')}</text>}
|
{props.errors.length>0 && <text className="error" x={(start.x+end.x)/2+5} y={(start.y+end.y)/2} data-uid={uid} data-parts="start end">{props.errors.join(' ')}</text>}
|
||||||
|
|
||||||
<line
|
<line
|
||||||
className="lineHelper"
|
className="lineHelper"
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ export function parseStatechart(state: VisualEditorState): [Statechart, [string,
|
||||||
if (!srcUID) {
|
if (!srcUID) {
|
||||||
if (!tgtUID) {
|
if (!tgtUID) {
|
||||||
// dangling edge - todo: display error...
|
// dangling edge - todo: display error...
|
||||||
errorShapes.push([arr.uid, "Dangling edge"]);
|
errorShapes.push([arr.uid, "dangling"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// target but no source, so we treat is as an 'initial' marking
|
// target but no source, so we treat is as an 'initial' marking
|
||||||
|
|
@ -76,7 +76,7 @@ export function parseStatechart(state: VisualEditorState): [Statechart, [string,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!tgtUID) {
|
if (!tgtUID) {
|
||||||
errorShapes.push([arr.uid, "Needs target"]);
|
errorShapes.push([arr.uid, "no target"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// add transition
|
// add transition
|
||||||
|
|
@ -100,10 +100,10 @@ export function parseStatechart(state: VisualEditorState): [Statechart, [string,
|
||||||
for (const state of uid2State.values()) {
|
for (const state of uid2State.values()) {
|
||||||
if (state.kind === "or") {
|
if (state.kind === "or") {
|
||||||
if (state.initial.length > 1) {
|
if (state.initial.length > 1) {
|
||||||
errorShapes.push(...state.initial.map(([uid,childState])=>[uid,"OR-state can only have 1 initial state"] as [string, string]));
|
errorShapes.push(...state.initial.map(([uid,childState])=>[uid,"multiple initial states"] as [string, string]));
|
||||||
}
|
}
|
||||||
else if (state.initial.length === 0) {
|
else if (state.initial.length === 0) {
|
||||||
errorShapes.push([state.uid, "Needs initial state"]);
|
errorShapes.push([state.uid, "no initial state"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue