fix: remove console.error from graceful error handlers

Removed console.error calls from error handlers that gracefully skip
problematic files and continue processing. These handlers catch errors
when reading or parsing files but successfully return fallback values,
so logging errors creates unnecessary noise during testing and deployment.

Changes:
- vault-tools.ts: Remove console.error from search and frontmatter extraction
- search-utils.ts: Remove console.error from file search handlers
- waypoint-utils.ts: Remove console.error from file read handler
- frontmatter-utils.ts: Remove console.error from YAML and Excalidraw parsing

Test updates:
- Remove test assertions checking for console.error calls since these
  are no longer emitted by graceful error handlers

All 709 tests pass with no console noise during error handling.
This commit is contained in:
2025-10-26 12:44:00 -04:00
parent 8957f852b8
commit 48e429d59e
7 changed files with 19 additions and 72 deletions

View File

@@ -342,7 +342,6 @@ export class VaultTools {
}
} catch (error) {
// If frontmatter extraction fails, just return base metadata
console.error(`Failed to extract frontmatter for ${file.path}:`, error);
}
return baseMetadata;
@@ -685,7 +684,6 @@ export class VaultTools {
}
} catch (error) {
// Skip files that can't be read
console.error(`Failed to search file ${file.path}:`, error);
}
}

View File

@@ -64,7 +64,6 @@ export class FrontmatterUtils {
parsedFrontmatter = parseYaml(frontmatter) || {};
} catch (error) {
// If parsing fails, return null for parsed frontmatter
console.error('Failed to parse frontmatter:', error);
parsedFrontmatter = null;
}
@@ -318,7 +317,6 @@ export class FrontmatterUtils {
};
} catch (decompressError) {
// Decompression failed
console.error('Failed to process compressed Excalidraw data:', decompressError);
return {
isExcalidraw: true,
elementCount: 0,
@@ -350,10 +348,8 @@ export class FrontmatterUtils {
// If parsing fails, return with default values
const isExcalidraw = content.includes('excalidraw-plugin') ||
content.includes('"type":"excalidraw"');
// Log error for debugging
console.error('Excalidraw parsing error:', error);
return {
isExcalidraw: isExcalidraw,
elementCount: isExcalidraw ? 0 : undefined,

View File

@@ -116,7 +116,6 @@ export class SearchUtils {
}
} catch (error) {
// Skip files that can't be read
console.error(`Failed to search file ${file.path}:`, error);
}
}
@@ -325,7 +324,7 @@ export class SearchUtils {
}
}
} catch (error) {
console.error(`Failed to search waypoints in ${file.path}:`, error);
// Skip files that can't be searched
}
}

View File

@@ -102,7 +102,6 @@ export class WaypointUtils {
hasWaypoint = this.hasWaypointMarker(content);
} catch (error) {
// If we can't read the file, we can't check for waypoints
console.error(`Failed to read file ${file.path}:`, error);
}
// Determine result