Add try catch to behaviors
This commit is contained in:
parent
5fdee602f1
commit
5fdbd771ff
3 changed files with 24 additions and 20 deletions
|
@ -13,6 +13,7 @@ import { ApplySymbol } from './SymbolBehaviors';
|
||||||
* @returns Updated container
|
* @returns Updated container
|
||||||
*/
|
*/
|
||||||
export function ApplyBehaviors(container: IContainerModel, symbols: Map<string, ISymbolModel>): IContainerModel {
|
export function ApplyBehaviors(container: IContainerModel, symbols: Map<string, ISymbolModel>): IContainerModel {
|
||||||
|
try {
|
||||||
if (container.properties.isAnchor) {
|
if (container.properties.isAnchor) {
|
||||||
ApplyAnchor(container);
|
ApplyAnchor(container);
|
||||||
}
|
}
|
||||||
|
@ -32,6 +33,10 @@ export function ApplyBehaviors(container: IContainerModel, symbols: Map<string,
|
||||||
ApplyBehaviors(child, symbols);
|
ApplyBehaviors(child, symbols);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,7 @@ function FlexGroup(flexibleGroup: IFlexibleGroup): void {
|
||||||
// title: 'Cannot fit!',
|
// title: 'Cannot fit!',
|
||||||
// text: 'Cannot fit at all even when squeezing all flex containers to the minimum.'
|
// text: 'Cannot fit at all even when squeezing all flex containers to the minimum.'
|
||||||
// });
|
// });
|
||||||
console.error('[FlexBehavior] Cannot fit at all even when squeezing all flex containers to the minimum.');
|
throw new Error('[FlexBehavior] Cannot fit at all even when squeezing all flex containers to the minimum.');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxMinWidths = Math.max(...minWidths);
|
const maxMinWidths = Math.max(...minWidths);
|
||||||
|
|
|
@ -183,7 +183,7 @@ function ApplyMainLoop(oldMatrix: number[][], rowlength: number): number[][] {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tries === 0) {
|
if (tries === 0) {
|
||||||
throw new Error('[Flex]Simplexe: Could not find a solution');
|
throw new Error('[Flex] Simplexe: Could not find a solution');
|
||||||
}
|
}
|
||||||
|
|
||||||
return matrix;
|
return matrix;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue