chore: fix cannot read properties of null (reading 'id') sentry error (#15323)

This commit is contained in:
akash-codemonk 2022-07-27 16:25:41 +05:30 committed by GitHub
parent e5d89e7099
commit 526f2a8be6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 9 deletions

View File

@ -40,7 +40,12 @@ import history from "utils/history";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import AppEngine, { AppEnginePayload } from ".";
import AppEngine, {
ActionsNotFoundError,
AppEnginePayload,
PluginFormConfigsNotFoundError,
PluginsNotFoundError,
} from ".";
export default class AppEditorEngine extends AppEngine {
constructor(mode: APP_MODE) {
@ -114,7 +119,10 @@ export default class AppEditorEngine extends AppEngine {
failureActionEffects,
);
if (!allActionCalls) return;
if (!allActionCalls)
throw new ActionsNotFoundError(
`Unable to fetch actions for the application: ${applicationId}`,
);
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
}
@ -147,7 +155,8 @@ export default class AppEditorEngine extends AppEngine {
errorActions,
);
if (!initActionCalls) return;
if (!initActionCalls)
throw new PluginsNotFoundError("Unable to fetch plugins");
const pluginFormCall: boolean = yield call(
failFastApiCalls,
@ -155,7 +164,10 @@ export default class AppEditorEngine extends AppEngine {
[ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_SUCCESS],
[ReduxActionErrorTypes.FETCH_PLUGIN_FORM_CONFIGS_ERROR],
);
if (!pluginFormCall) return;
if (!pluginFormCall)
throw new PluginFormConfigsNotFoundError(
"Unable to fetch plugin form configs",
);
}
public *loadAppEntities(toLoadPageId: string, applicationId: string): any {

View File

@ -23,7 +23,7 @@ import { failFastApiCalls } from "sagas/InitSagas";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import AppEngine, { AppEnginePayload } from ".";
import AppEngine, { ActionsNotFoundError, AppEnginePayload } from ".";
export default class AppViewerEngine extends AppEngine {
constructor(mode: APP_MODE) {
@ -93,7 +93,10 @@ export default class AppViewerEngine extends AppEngine {
],
);
if (!resultOfPrimaryCalls) return;
if (!resultOfPrimaryCalls)
throw new ActionsNotFoundError(
`Unable to fetch actions for the application: ${applicationId}`,
);
yield put(fetchAllPageEntityCompletion([executePageLoadActions()]));
}

View File

@ -33,7 +33,11 @@ export interface IAppEngine {
completeChore(): any;
}
export class PageNotFoundError extends Error {}
export class AppEngineApiError extends Error {}
export class PageNotFoundError extends AppEngineApiError {}
export class ActionsNotFoundError extends AppEngineApiError {}
export class PluginsNotFoundError extends AppEngineApiError {}
export class PluginFormConfigsNotFoundError extends AppEngineApiError {}
export default abstract class AppEngine {
private _mode: APP_MODE;

View File

@ -32,8 +32,8 @@ import { getIsInitialized as getIsViewerInitialized } from "selectors/appViewSel
import { enableGuidedTour } from "actions/onboardingActions";
import { setPreviewModeAction } from "actions/editorActions";
import AppEngine, {
AppEngineApiError,
AppEnginePayload,
PageNotFoundError,
} from "entities/Engine";
import AppEngineFactory from "entities/Engine/factory";
import { ApplicationPagePayload } from "api/ApplicationApi";
@ -95,8 +95,8 @@ export function* startAppEngine(action: ReduxAction<AppEnginePayload>) {
engine.stopPerformanceTracking();
} catch (e) {
log.error(e);
if (e instanceof AppEngineApiError) return;
Sentry.captureException(e);
if (e instanceof PageNotFoundError) return;
yield put({
type: ReduxActionTypes.SAFE_CRASH_APPSMITH_REQUEST,
payload: {