Various improvements #169

Merged
schmelczer merged 78 commits from asch/saturday into main 2025-11-30 15:24:52 +00:00
2 changed files with 8 additions and 3 deletions
Showing only changes of commit 31d4343fb1 - Show all commits

Have the same error message for file not found

Andras Schmelczer 2025-11-22 20:19:13 +00:00

View file

@ -1,5 +1,8 @@
export class FileNotFoundError extends Error {
public constructor(message: string) {
public constructor(
message: string,
public readonly filePath: string
) {
copilot-pull-request-reviewer[bot] commented 2025-11-30 15:03:03 +00:00 (Migrated from github.com)

Adding a required filePath parameter to FileNotFoundError changes its constructor signature, which is a breaking change for any existing code that constructs this error. Consider making filePath optional with a default value to maintain backwards compatibility.

		public readonly filePath?: string
Adding a required filePath parameter to FileNotFoundError changes its constructor signature, which is a breaking change for any existing code that constructs this error. Consider making filePath optional with a default value to maintain backwards compatibility. ```suggestion public readonly filePath?: string ```
super(message);
this.name = "FileNotFoundError";
}

View file

@ -117,7 +117,8 @@ export class SafeFileSystemOperations implements FileSystemOperations {
): Promise<T> {
if (!(await this.fs.exists(path))) {
throw new FileNotFoundError(
`File '${path}' not found before trying to ${operationName}`
`File not found before trying to ${operationName}`,
path
);
}
@ -131,7 +132,8 @@ export class SafeFileSystemOperations implements FileSystemOperations {
throw error;
} else {
throw new FileNotFoundError(
`File '${path}' not found when trying to ${operationName}`
`File not found when trying to ${operationName}`,
path
);
}
}