MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / buildErrorLogData

Function buildErrorLogData

src/utils/errorHandler.js:151–183  ·  view source on GitHub ↗
(interaction, error, errorType, context = {})

Source from the content-addressed store, hash-verified

149}
150
151function buildErrorLogData(interaction, error, errorType, context = {}) {
152 const resolvedErrorCode = resolveErrorCode({ error, errorType, context });
153 const errorMetadata = getErrorMetadata(resolvedErrorCode);
154 const traceId = context.traceId || interaction?.traceContext?.traceId || interaction?.traceId || error?.context?.traceId;
155
156 return {
157 logData: {
158 event: 'interaction.error',
159 errorCode: resolvedErrorCode,
160 remediationHint: errorMetadata.remediation,
161 severity: errorMetadata.severity,
162 retryable: errorMetadata.retryable,
163 error: error.message,
164 type: errorType,
165 traceId,
166 guildId: interaction?.guildId,
167 userId: interaction?.user?.id,
168 command: interaction?.commandName || context.command,
169 interaction: interaction ? {
170 type: interaction.type,
171 commandName: interaction.commandName,
172 customId: interaction.customId,
173 userId: interaction.user?.id,
174 guildId: interaction.guildId,
175 channelId: interaction.channelId
176 } : undefined,
177 context
178 },
179 traceId,
180 resolvedErrorCode,
181 errorMetadata
182 };
183}
184
185function logInteractionError(error, errorType, logData) {
186 const isUserError = [

Callers 2

replyUserErrorFunction · 0.85
handleInteractionErrorFunction · 0.85

Calls 2

resolveErrorCodeFunction · 0.90
getErrorMetadataFunction · 0.90

Tested by

no test coverage detected