Handle exception where prepared statements viewer does not get a value (#5531)

This commit is contained in:
Hetu Nandu 2021-07-05 16:29:48 +05:30 committed by GitHub
parent 3391ead510
commit 75c439f66d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,8 @@ import {
EvaluationError,
PropertyEvaluationErrorType,
} from "utils/DynamicBindingUtils";
import * as Sentry from "@sentry/react";
import { Severity } from "@sentry/react";
const Wrapper = styled.div`
position: relative;
@ -155,6 +157,13 @@ export function PreparedStatementViewer(props: {
evaluatedValue: PreparedStatementValue;
}) {
const { parameters, value } = props.evaluatedValue;
if (!value) {
Sentry.captureException("Prepared Statement got no value", {
level: Severity.Debug,
extra: { props },
});
return <div />;
}
const stringSegments = value.split(/\$\d/);
const $params = [...value.matchAll(/\$\d/g)].map((matches) => matches[0]);
const paramsWithTooltips = $params.map((param) => (