Fix AbsurdSQL fallback mode write failures and singleton issues

Attempts to resolve "Fallback mode unable to write file changes" errors and prevents
multiple AbsurdSQL instances during initialization. Adds proactive database
logging protection and global error handling for IndexedDB write failures.
This commit is contained in:
Matthew Raymer
2025-07-01 10:33:13 +00:00
parent 972c3450ac
commit 28eb98508e
10 changed files with 1718 additions and 128 deletions

View File

@@ -385,11 +385,42 @@ export class WebPlatformService implements PlatformService {
}
/**
* Rotates the camera between front and back cameras.
* @returns Promise that resolves when the camera is rotated
* @throws Error indicating camera rotation is not implemented in web platform
* Camera rotation not implemented for web platform
*/
async rotateCamera(): Promise<void> {
throw new Error("Camera rotation not implemented in web platform");
// No-op for web platform - camera rotation not supported
}
/**
* Gets diagnostic information about the database service state
* @returns Diagnostic information from the AbsurdSQL service
*/
getDatabaseDiagnostics(): any {
return databaseService.getDiagnostics();
}
/**
* Performs a health check on the database service
* @returns Promise resolving to true if the database is healthy
*/
async checkDatabaseHealth(): Promise<boolean> {
try {
// Try a simple query to check if database is operational
const result = await databaseService.query("SELECT 1 as test");
const isHealthy = result && result.length > 0 && result[0].values.length > 0;
logger.info("[WebPlatformService] Database health check", {
isHealthy,
timestamp: new Date().toISOString(),
});
return isHealthy;
} catch (error) {
logger.error("[WebPlatformService] Database health check failed", {
error: error instanceof Error ? error.message : String(error),
timestamp: new Date().toISOString(),
});
return false;
}
}
}