Improve cylical dependency error (#3471)
This commit is contained in:
parent
08ebbe410b
commit
4e4c6b76a8
|
|
@ -110,7 +110,7 @@ const ToastComponent = (props: ToastProps & { undoAction?: () => void }) => {
|
|||
return (
|
||||
<ToastBody
|
||||
variant={props.variant || Variant.info}
|
||||
isUndo={props.onUndo ? true : false}
|
||||
isUndo={!!props.onUndo}
|
||||
dispatchableAction={props.dispatchableAction}
|
||||
className="t--toast-action"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -43,11 +43,24 @@ const evalErrorHandler = (errors: EvalError[]) => {
|
|||
errors.forEach((error) => {
|
||||
switch (error.type) {
|
||||
case EvalErrorTypes.DEPENDENCY_ERROR: {
|
||||
Toaster.show({
|
||||
text: error.message,
|
||||
variant: Variant.danger,
|
||||
});
|
||||
Sentry.captureException(new Error(error.message));
|
||||
if (error.context) {
|
||||
// Add more info about node for the toast
|
||||
const { node, entityType } = error.context;
|
||||
Toaster.show({
|
||||
text: `${error.message} Node was: ${node}`,
|
||||
variant: Variant.danger,
|
||||
});
|
||||
// Send the generic error message to sentry for better grouping
|
||||
Sentry.captureException(new Error(error.message), {
|
||||
tags: {
|
||||
node,
|
||||
entityType,
|
||||
},
|
||||
// Level is warning because it could be a user error
|
||||
level: Sentry.Severity.Warning,
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case EvalErrorTypes.EVAL_TREE_ERROR: {
|
||||
|
|
|
|||
|
|
@ -460,9 +460,26 @@ export default class DataTreeEvaluator {
|
|||
.reverse()
|
||||
.filter((d) => !!d);
|
||||
} catch (e) {
|
||||
// Cyclic dependency found. Extract all node and entity type
|
||||
const node = e.message.match(
|
||||
new RegExp('Cyclic dependency, node was:"(.*)"'),
|
||||
)[1];
|
||||
|
||||
let entityType = "UNKNOWN";
|
||||
const entityName = node.split(".")[0];
|
||||
const entity = _.find(this.oldUnEvalTree, { name: entityName });
|
||||
if (entity && isWidget(entity)) {
|
||||
entityType = entity.type;
|
||||
} else if (entity && isAction(entity)) {
|
||||
entityType = entity.pluginType;
|
||||
}
|
||||
this.errors.push({
|
||||
type: EvalErrorTypes.DEPENDENCY_ERROR,
|
||||
message: e.message,
|
||||
message: "Cyclic dependency found while evaluating.",
|
||||
context: {
|
||||
node,
|
||||
entityType,
|
||||
},
|
||||
});
|
||||
console.error("CYCLICAL DEPENDENCY MAP", dependencyMap);
|
||||
throw new CrashingError(e.message);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user