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