mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-19 22:19:45 +02:00
try implementing assert as if->throw
This commit is contained in:
@@ -63,8 +63,12 @@ const getNextFittingBlock = (
|
|||||||
row: number,
|
row: number,
|
||||||
bitsPerRow: number
|
bitsPerRow: number
|
||||||
): [Required<PacketBlock>, PacketBlock | undefined] => {
|
): [Required<PacketBlock>, PacketBlock | undefined] => {
|
||||||
assert(block.start !== undefined, 'start should have been set during first phase');
|
if (block.start === undefined) {
|
||||||
assert(block.end !== undefined, 'end should have been set during first phase');
|
throw new Error('start should have been set during first phase');
|
||||||
|
}
|
||||||
|
if (block.end === undefined) {
|
||||||
|
throw new Error('end should have been set during first phase');
|
||||||
|
}
|
||||||
|
|
||||||
if (block.start > block.end) {
|
if (block.start > block.end) {
|
||||||
throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);
|
throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);
|
||||||
|
Reference in New Issue
Block a user