diff --git a/app/client/src/components/ads/Toast.tsx b/app/client/src/components/ads/Toast.tsx index f3aa0ba43e..ad54862175 100644 --- a/app/client/src/components/ads/Toast.tsx +++ b/app/client/src/components/ads/Toast.tsx @@ -110,7 +110,7 @@ const ToastComponent = (props: ToastProps & { undoAction?: () => void }) => { return ( diff --git a/app/client/src/sagas/EvaluationsSaga.ts b/app/client/src/sagas/EvaluationsSaga.ts index 2d848b8b94..f38d095517 100644 --- a/app/client/src/sagas/EvaluationsSaga.ts +++ b/app/client/src/sagas/EvaluationsSaga.ts @@ -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: { diff --git a/app/client/src/workers/DataTreeEvaluator.ts b/app/client/src/workers/DataTreeEvaluator.ts index 12272c9425..3921a7b91c 100644 --- a/app/client/src/workers/DataTreeEvaluator.ts +++ b/app/client/src/workers/DataTreeEvaluator.ts @@ -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);