chore: log evaluation error logs and push execption to sentry (#40170)
## Description
This PR makes sure that any error in evaluation is not supressed by the
code and when it happens it does the following
- Shows a generic evaluation error to the user as a toast message
- Log the error in the main thread console
- Send an exception to Sentry
Fixes #`Issue Number`
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._
## Automation
/ok-to-test tags="@tag.All"
### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!CAUTION]
> If you modify the content in this section, you are likely to disrupt
the CI result for your PR.
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Bug Fixes**
- Enhanced error logging and reporting to ensure evaluation issues are
consistently captured and tracked.
- **Chores**
- Expanded error diagnostics by including additional context for
improved troubleshooting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
00adc9ee62
commit
410e4ea999
|
|
@ -255,35 +255,35 @@ export function* evalErrorHandler(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.error(error);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EvalErrorTypes.EVAL_TREE_ERROR: {
|
case EvalErrorTypes.EVAL_TREE_ERROR: {
|
||||||
toast.show(createMessage(ERROR_EVAL_ERROR_GENERIC), {
|
toast.show(createMessage(ERROR_EVAL_ERROR_GENERIC), {
|
||||||
kind: "error",
|
kind: "error",
|
||||||
});
|
});
|
||||||
|
log.error(error);
|
||||||
|
Sentry.captureException(error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EvalErrorTypes.BAD_UNEVAL_TREE_ERROR: {
|
case EvalErrorTypes.BAD_UNEVAL_TREE_ERROR: {
|
||||||
|
log.error(error);
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EvalErrorTypes.EVAL_PROPERTY_ERROR: {
|
case EvalErrorTypes.EVAL_PROPERTY_ERROR: {
|
||||||
log.debug(error);
|
Sentry.captureException(error);
|
||||||
|
log.error(error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EvalErrorTypes.CLONE_ERROR: {
|
case EvalErrorTypes.CLONE_ERROR: {
|
||||||
/*
|
log.debug(error);
|
||||||
* https://github.com/appsmithorg/appsmith/issues/2654
|
Sentry.captureException(new Error(error.message), {
|
||||||
* This code is being commented out to prevent these errors from going to Sentry
|
extra: {
|
||||||
* till we come up with a more definitive solution to prevent this error
|
request: error.context,
|
||||||
* Proposed solution - adding lint errors to editor to prevent these from happening
|
},
|
||||||
* */
|
});
|
||||||
|
|
||||||
// Sentry.captureException(new Error(error.message), {
|
|
||||||
// extra: {
|
|
||||||
// request: error.context,
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EvalErrorTypes.PARSE_JS_ERROR: {
|
case EvalErrorTypes.PARSE_JS_ERROR: {
|
||||||
|
|
@ -293,6 +293,8 @@ export function* evalErrorHandler(
|
||||||
AppsmithConsole.error({
|
AppsmithConsole.error({
|
||||||
text: `${error.message} at: ${error.context?.propertyPath}`,
|
text: `${error.message} at: ${error.context?.propertyPath}`,
|
||||||
});
|
});
|
||||||
|
log.error(error);
|
||||||
|
Sentry.captureException(error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EvalErrorTypes.EXTRACT_DEPENDENCY_ERROR: {
|
case EvalErrorTypes.EXTRACT_DEPENDENCY_ERROR: {
|
||||||
|
|
@ -302,7 +304,8 @@ export function* evalErrorHandler(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
log.debug(error);
|
log.error(error);
|
||||||
|
Sentry.captureException(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,7 @@ export interface EvalError {
|
||||||
// TODO: Fix this the next time the file is edited
|
// TODO: Fix this the next time the file is edited
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
context?: Record<string, any>;
|
context?: Record<string, any>;
|
||||||
|
stack?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DynamicPath {
|
export interface DynamicPath {
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,7 @@ import type { EvalMetaUpdates } from "ee/workers/common/DataTreeEvaluator/types"
|
||||||
import { makeEntityConfigsAsObjProperties } from "ee/workers/Evaluation/dataTreeUtils";
|
import { makeEntityConfigsAsObjProperties } from "ee/workers/Evaluation/dataTreeUtils";
|
||||||
import type { DataTreeDiff } from "ee/workers/Evaluation/evaluationUtils";
|
import type { DataTreeDiff } from "ee/workers/Evaluation/evaluationUtils";
|
||||||
import { serialiseToBigInt } from "ee/workers/Evaluation/evaluationUtils";
|
import { serialiseToBigInt } from "ee/workers/Evaluation/evaluationUtils";
|
||||||
import {
|
import { getSafeToRenderDataTree } from "ee/workers/Evaluation/evaluationUtils";
|
||||||
CrashingError,
|
|
||||||
getSafeToRenderDataTree,
|
|
||||||
} from "ee/workers/Evaluation/evaluationUtils";
|
|
||||||
import type { EvalTreeRequestData, EvalWorkerASyncRequest } from "../types";
|
import type { EvalTreeRequestData, EvalWorkerASyncRequest } from "../types";
|
||||||
import { clearAllIntervals } from "../fns/overrides/interval";
|
import { clearAllIntervals } from "../fns/overrides/interval";
|
||||||
import JSObjectCollection from "workers/Evaluation/JSObject/Collection";
|
import JSObjectCollection from "workers/Evaluation/JSObject/Collection";
|
||||||
|
|
@ -272,14 +269,14 @@ export async function evalTree(
|
||||||
logs = dataTreeEvaluator.logs;
|
logs = dataTreeEvaluator.logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(error instanceof CrashingError)) {
|
|
||||||
errors.push({
|
errors.push({
|
||||||
type: EvalErrorTypes.UNKNOWN_ERROR,
|
type: EvalErrorTypes.EVAL_TREE_ERROR,
|
||||||
message: (error as Error).message,
|
message: (error as Error).message,
|
||||||
|
stack: (error as Error).stack,
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
|
||||||
|
|
||||||
dataTree = getSafeToRenderDataTree(
|
dataTree = getSafeToRenderDataTree(
|
||||||
makeEntityConfigsAsObjProperties(unevalTree, {
|
makeEntityConfigsAsObjProperties(unevalTree, {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user