Skip to content

Commit

Permalink
fix: Don't crash on an 'UNKNOWN: unknown error, lstat' error
Browse files Browse the repository at this point in the history
  • Loading branch information
symwell committed Dec 13, 2022
1 parent 534a7a7 commit a631928
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/cli/src/fingerprint/fingerprintWatchCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export default class FingerprintWatchCommand {
await this.watcher?.close();
this.watcher = undefined;
console.warn("File watching disabled.");
} else if (error.message.includes("UNKNOWN: unknown error, lstat")) {
console.warn(error.stack);
} else {
// let it crash if it's some other error, to learn what the error is
throw error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ describe(FingerprintWatchCommand, () => {
expect(cmd.watcher).toBeUndefined();
});

it('does not raise on unknown error lstat', async () => {
cmd = new FingerprintWatchCommand(appMapDir);
cmd.watcher = new FSWatcher();
expect(cmd.watcher).not.toBeUndefined();
console.warn = jest.fn();
const errorMessage = "UNKNOWN: unknown error, lstat";
await cmd.watcherErrorFunction(new Error(errorMessage));
expect(cmd.watcher).not.toBeUndefined();
expect(console.warn).toBeCalledTimes(1);
expect(console.warn).toHaveBeenCalledWith(expect.stringContaining(errorMessage));
});

describe('telemetry', () => {
let handler: Fingerprinter;

Expand Down

0 comments on commit a631928

Please sign in to comment.