(error, errorType, logData)
| 183 | } |
| 184 | |
| 185 | function logInteractionError(error, errorType, logData) { |
| 186 | const isUserError = [ |
| 187 | ErrorTypes.VALIDATION, |
| 188 | ErrorTypes.RATE_LIMIT, |
| 189 | ErrorTypes.USER_INPUT, |
| 190 | ErrorTypes.PERMISSION |
| 191 | ].includes(errorType); |
| 192 | const isExpectedError = Boolean(error?.context?.expected === true || error?.context?.suppressErrorLog === true); |
| 193 | |
| 194 | if (isUserError || isExpectedError) { |
| 195 | if (errorType !== ErrorTypes.RATE_LIMIT) { |
| 196 | logger.debug(`User Error [${errorType.toUpperCase()}]: ${error.message}`, logData); |
| 197 | } |
| 198 | } else { |
| 199 | logger.error(`System Error [${errorType.toUpperCase()}]`, { |
| 200 | ...logData, |
| 201 | stack: error.stack |
| 202 | }); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | async function sendErrorResponse(interaction, embed, context = {}) { |
| 207 | try { |
no outgoing calls
no test coverage detected