PromucFlow_constructor/app/client/src/actions/debuggerActions.ts
ChandanBalajiBP 6587a18512
chore: Add telemetry for resolved error message (#22339)
## Description

> Adds errorID, tat and appsmith error code to plugin execution errors

Fixes #22348 

## Type of change

> Please delete options that are not relevant.
- Chore (housekeeping or task changes that don't impact user perception)


## How Has This Been Tested?

- Manual

## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
2023-04-13 20:58:29 +05:30

122 lines
3.1 KiB
TypeScript

import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import type { ENTITY_TYPE, Log, Message } from "entities/AppsmithConsole";
import type { DebuggerContext } from "reducers/uiReducers/debuggerReducer";
import type { EventName } from "utils/AnalyticsUtil";
export interface LogDebuggerErrorAnalyticsPayload {
entityName: string;
entityId: string;
entityType: ENTITY_TYPE;
eventName: EventName;
propertyPath: string;
errorId?: string;
errorMessages?: Message[];
errorMessage?: Message["message"];
errorType?: Message["type"];
errorSubType?: Message["subType"];
analytics?: Log["analytics"];
}
export const debuggerLogInit = (payload: Log[]) => ({
type: ReduxActionTypes.DEBUGGER_LOG_INIT,
payload,
});
export const debuggerLog = (payload: Log[]) => ({
type: ReduxActionTypes.DEBUGGER_LOG,
payload,
});
export const clearLogs = () => ({
type: ReduxActionTypes.CLEAR_DEBUGGER_LOGS,
});
export const showDebugger = (payload?: boolean) => ({
type: ReduxActionTypes.SHOW_DEBUGGER,
payload,
});
// Add an error
export const addErrorLogInit = (payload: Log[]) => ({
type: ReduxActionTypes.DEBUGGER_ADD_ERROR_LOG_INIT,
payload,
});
export const addErrorLogs = (payload: Log[]) => ({
type: ReduxActionTypes.DEBUGGER_ADD_ERROR_LOGS,
payload,
});
export const deleteErrorLogsInit = (
payload: { id: string; analytics?: Log["analytics"] }[],
) => ({
type: ReduxActionTypes.DEBUGGER_DELETE_ERROR_LOG_INIT,
payload,
});
export const deleteErrorLog = (ids: string[]) => ({
type: ReduxActionTypes.DEBUGGER_DELETE_ERROR_LOG,
payload: ids,
});
// Only used for analytics
export const logDebuggerErrorAnalytics = (
payload: LogDebuggerErrorAnalyticsPayload,
) => ({
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
payload,
});
export const hideDebuggerErrors = (payload: boolean) => ({
type: ReduxActionTypes.HIDE_DEBUGGER_ERRORS,
payload,
});
// set the selected tab in the debugger.
export const setDebuggerSelectedTab = (selectedTab: string) => {
return {
type: ReduxActionTypes.SET_DEBUGGER_SELECTED_TAB,
selectedTab,
};
};
// set the height of the response pane in the debugger.
export const setResponsePaneHeight = (height: number) => {
return {
type: ReduxActionTypes.SET_RESPONSE_PANE_HEIGHT,
height,
};
};
// set the height of the response pane in the debugger.
export const setErrorCount = (count: number) => {
return {
type: ReduxActionTypes.SET_ERROR_COUNT,
count,
};
};
// set the height of the response pane in the debugger.
export const setResponsePaneScrollPosition = (position: number) => {
return {
type: ReduxActionTypes.SET_RESPONSE_PANE_SCROLL_POSITION,
position,
};
};
//toggle expand error log item state.
export const toggleExpandErrorLogItem = (id: string, isExpanded: boolean) => {
return {
type: ReduxActionTypes.TOGGLE_EXPAND_ERROR_LOG_ITEM,
payload: { id, isExpanded },
};
};
//set the debugger context in store.
export const setDebuggerContext = (context: DebuggerContext) => {
return {
type: ReduxActionTypes.SET_DEBUGGER_CONTEXT,
payload: { context },
};
};