Skip to content

Commit

Permalink
Add logging and bug tracker error if issue fetching metadata for edit…
Browse files Browse the repository at this point in the history
… record modal
  • Loading branch information
paustint committed Jun 13, 2024
1 parent 7f80f21 commit cc2482d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/shared/ui-core/src/record/ViewEditCloneRecord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { mockPicklistValuesFromSobjectDescribe, UiRecordForm } from '@jetstream/
import { logger } from '@jetstream/shared/client-logger';
import { ANALYTICS_KEYS, SOBJECT_NAME_FIELD_MAP } from '@jetstream/shared/constants';
import { describeGlobal, describeSObject, genericRequest, query, sobjectOperation } from '@jetstream/shared/data';
import { copyRecordsToClipboard, isErrorResponse, useNonInitialEffect } from '@jetstream/shared/ui-utils';
import { copyRecordsToClipboard, isErrorResponse, useNonInitialEffect, useRollbar } from '@jetstream/shared/ui-utils';
import {
AsyncJobNew,
BulkDownloadJob,
Expand Down Expand Up @@ -138,6 +138,7 @@ export const ViewEditCloneRecord: FunctionComponent<ViewEditCloneRecordProps> =
const isMounted = useRef(true);
const modalRef = useRef(null);
const modalBodyRef = useRef<HTMLDivElement>(null);
const rollbar = useRollbar();
// If user was ever in view mode, clicking cancel will take back to view instead of close
const hasEverBeenInViewMode = useRef(false);
hasEverBeenInViewMode.current = action === 'view' || hasEverBeenInViewMode.current;
Expand Down Expand Up @@ -288,6 +289,8 @@ export const ViewEditCloneRecord: FunctionComponent<ViewEditCloneRecordProps> =
}
} catch (ex) {
if (isMounted.current) {
logger.error('Error fetching metadata', ex);
rollbar.error('Error fetching record metadata', { message: ex.message, stack: ex.stack });
setFormErrors({
hasErrors: true,
fieldErrors: {},
Expand Down

0 comments on commit cc2482d

Please sign in to comment.