Improved error handling and added protection against race conditions in the bot controller. Extracted Microsoft domain verification for better maintainability. Added support for custom activity managers and improved documentation.

This commit is contained in:
2025-11-10 22:20:34 +01:00
parent e9a1e2dbcf
commit 84a4461a2f
5 changed files with 96 additions and 14 deletions

View File

@@ -9,6 +9,24 @@ export function getErrorMessage(error: unknown): string {
return error instanceof Error ? error.message : String(error)
}
/**
* Format a standardized error message for logging
* Ensures consistent error message formatting across all modules
*
* @param context - Context string (e.g., 'SEARCH-BING', 'LOGIN')
* @param error - Error object or unknown value
* @param prefix - Optional custom prefix (defaults to 'Error')
* @returns Formatted error message
*
* @example
* formatErrorMessage('SEARCH', err) // 'Error in SEARCH: Network timeout'
* formatErrorMessage('LOGIN', err, 'Failed') // 'Failed in LOGIN: Invalid credentials'
*/
export function formatErrorMessage(context: string, error: unknown, prefix: string = 'Error'): string {
const errorMsg = getErrorMessage(error)
return `${prefix} in ${context}: ${errorMsg}`
}
/**
* Utility class for common operations
* IMPROVED: Added comprehensive documentation