日本語
エラーと検証
公開されている関数とコンポーネントは、入口で入力を検証します。不正な数値やジオメトリは RangeError、不正な参照、不正または重複した ID、循環は Error を投げます。循環や実行不可能な計画などのスケジューリングの失敗は、例外ではなく結果として返ります。コンポーネントは不正なプロップを validation-error イベントで知らせ、空の状態を描いてからエラーを再送出します。
分岐にはエラーのクラスと、診断の code と id を使い、メッセージの文面は使わないでください。下の文面はログを読む人のためのもので、マイナーリリースで変わることがあります。
ts
import { scheduleTasks } from '@eightkk/vue-weave/core'
try {
const result = scheduleTasks(input)
if (!result.ok) showDiagnostics(result) // 循環や実行不可能な計画は結果として返る
} catch (error) {
if (error instanceof RangeError) reportBadNumber(error) // 有限でない時刻、逆転した範囲
else throw error // 不正な参照、重複した ID
}計画の診断は計画の診断とスケジュールのトレースを、ユーザーの編集を拒否する方法は各コンポーネントの validateEdit、validateConnection、validateCellEdit を参照してください。
英語の詳細
ここから下の詳細なリファレンスは英語です。
Validation and errors
The planning, timeline and data functions of @eightkk/vue-weave/core (scheduling, leveling and resource load, status-date and actuals rescheduling, plan comparison, placement, resource timelines, timeline data and row trees, renderTimelineSvg, snapshots, windowed data and the MS Project, iCalendar and CSV interchange), its graph functions (indexGraph and everything that validates a graph through it: every layout, the algorithms and analysis, editing, port rules and renderGraphSvg; group collapse, swimlanes, traversal, layout requests and the view bindings) and the prop checks of GanttChart and NetworkGraph share one ID rule: an ID is a non-empty string, and IDs are unique within their collection. Any other value (a number such as 0 or 5, '', null, undefined, an object) is invalid. Each failure kind currently has one message format, thrown as an Error. The texts help people read logs; they are not part of the compatibility promise, so code should check the class:
| Failure | Message |
|---|---|
| Invalid ID | Invalid <kind> ID: <value>, for example Invalid task ID: 5, Invalid row ID: "" or Invalid calendar ID: undefined (an empty string shows as "", an object or array as object or array) |
| Duplicate ID | Duplicate <kind> ID: <id>, for example Duplicate dependency ID: d1 |
| Unknown dependency end | Unknown dependency endpoint: <dependency ID> |
| Unknown reference | Unknown <kind> in <owner>: <value>, where the owner is what holds the reference: Unknown resource in assignment: <id> or Unknown task in assignment: <id>; on the graph side Unknown node in graph edge <edge ID>: <node> (an edge from or to), Unknown port in graph edge <edge ID>: <port>, Unknown node in graph group <group ID>: <node>, Unknown parent group in graph group <group ID>: <parentId>, Unknown swimlane in graph node <node ID>: <lane> (laneOf), Unknown group in collapsedIds: <id>, Unknown node in roots: <id>, Unknown node in fixedIds: <id>, Unknown node in fromId: <id> and … in toId: <id> (shortestGraphPath), Unknown node in graph deletion: <id>, Unknown edge in graph deletion: <id>, Unknown node in graph clone: <id>, Unknown node in graph port rules: <id>, Unknown port in graph port rules: <port> (graph node <node ID>) and Unknown edge in graph connection check: <id> |
| Repeated assignment | Duplicate assignment of task <task ID> to resource <resource ID> |
The kinds are task, dependency, calendar, resource, row, bar, baseline set, marker, marker range, load row, event, unplanned task, windowed data item, windowed data link, view row (the rowIds of a WindowedView), graph page node, graph page edge, column (renderTimelineSvg and GanttChart columns), graph node, graph edge, port (named ports, unique per node), graph group, group member (a node listed by two groups, or twice by one), swimlane (lanes of layoutSwimlaneGraph, renderGraphSvg and the NetworkGraph lanes prop), export group (renderGraphSvg groups), graph layout request (the requestId of buildGraphLayoutRequests), entity and view target (view bindings; a load target's resourceId uses resource), item and parent (diffStructure keys and parent keys) (snapshot diagnostics also use node, edge, group and column). Where the same check runs in a context that the message would not show, the context is appended in parentheses: (current plan) or (candidate plan) for comparePlans, (before) or (after) for diffStructure, (actual interval of task <id>) for rescheduleFromActuals, (bar <id>) for TimelineBar.baselines, (baselineIds), (baseline <number>) for the timelineFromMsProject baselineId option, (in one response) for windowed data, (in one page) for graph expansion pages, (graph node <id>) for port IDs, (graph group <id>) for a repeated group member, (createId for <source ID>) for the IDs cloneGraphElements gets from createId (an ID already used in the input is a duplicate) and (load target) for the resourceId of a load view target. The context never changes the class: invalid numbers and geometry stay RangeError, references, duplicates and cycles Error. Snapshot diagnostics carry the same texts as their message.
The prop checks of GanttChart and NetworkGraph follow the same class rule: a RangeError for invalid numbers and geometry (non-finite times, sizes that are not positive, inverted ranges, out-of-range options) and for an unknown value of a string option such as selectionMode, background, edgeStyle, routingPolicy or dependencyStyle (as the core does for an unknown layout direction), and an Error for bad references, invalid or duplicate IDs and cycles. GanttChart's own ID checks use the strict rule and the texts above, with the kinds marker, load row, zoom preset and column (for example Invalid marker ID: 3, Duplicate column ID: c); its checks of columns, load rows, header bands and markers are the ones renderTimelineSvg runs, so both report the same class and text for the same input. NetworkGraph's node, edge, port, group and lane checks use the same rule and texts (for example Invalid graph node ID: 5, Duplicate graph group ID: g, Unknown node in graph group g: zz); its group checks and collapseGraphGroups share one implementation. Checks of data that a core function validates (rows, bars, dependencies, ranges, marker ranges, baselines, non-working periods, layout options, lanes, edge bands, positions and sizes) report the core's error. Numeric prop messages keep their own clear texts that name the prop, such as tooltipDelay must be finite and nonnegative, snap must be finite and positive, minDuration must be finite and positive or snapGrid must be a positive finite number of chart units.