🐛 fix(utils.ts): add try-catch blocks to handle errors in groupByFamily function
The try-catch blocks were added to handle errors that may occur when the function is called. This improves the robustness of the function and prevents it from crashing when an error occurs.
This commit is contained in:
parent
5a62bdc592
commit
e5676337b5
1 changed files with 23 additions and 13 deletions
|
|
@ -830,10 +830,16 @@ export function groupByFamily(data, baseClasses) {
|
|||
|
||||
Object.keys(data).map((d) => {
|
||||
Object.keys(data[d]).map((n) => {
|
||||
if (
|
||||
data[d][n].base_classes.some((r) => baseClasses.split("\n").includes(r))
|
||||
) {
|
||||
arrOfParent.push(d);
|
||||
try {
|
||||
if (
|
||||
data[d][n].base_classes.some((r) =>
|
||||
baseClasses.split("\n").includes(r)
|
||||
)
|
||||
) {
|
||||
arrOfParent.push(d);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -844,16 +850,20 @@ export function groupByFamily(data, baseClasses) {
|
|||
|
||||
Object.keys(data).map((d) => {
|
||||
Object.keys(data[d]).map((n) => {
|
||||
baseClasses.split("\n").forEach((tol) => {
|
||||
data[d][n].base_classes.forEach((data) => {
|
||||
if (tol == data) {
|
||||
arrOfType.push({
|
||||
family: d,
|
||||
type: data,
|
||||
});
|
||||
}
|
||||
try {
|
||||
baseClasses.split("\n").forEach((tol) => {
|
||||
data[d][n].base_classes.forEach((data) => {
|
||||
if (tol == data) {
|
||||
arrOfType.push({
|
||||
family: d,
|
||||
type: data,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue