Skip to content

Commit

Permalink
Fix incorrect function name in errors
Browse files Browse the repository at this point in the history
  • Loading branch information
baileyherbert committed Mar 17, 2022
1 parent ce2af6d commit b07f861
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function getFlags(options: NormalizedTimeOptions): number {
function invokeBindingAsync(path: string, times: NormalizedTimeOptions, flags: number, resolveLinks: boolean, callback: Callback): void {
nativeAddon.utimes(getPathBuffer(path), flags, times.btime, times.mtime, times.atime, resolveLinks, (result?: Error) => {
if (typeof result !== 'undefined') {
const name = resolveLinks ? 'lutimes' : 'utimes';
const name = resolveLinks ? 'utimes' : 'lutimes';
const message = result.message.trim().replace(/\.$/, '');
callback(new Error(`${message}, ${name} '${path}'`));
return;
Expand All @@ -316,7 +316,7 @@ function invokeBindingSync(path: string, times: NormalizedTimeOptions, flags: nu
nativeAddon.utimesSync(getPathBuffer(path), flags, times.btime, times.mtime, times.atime, resolveLinks);
}
catch (error) {
const name = resolveLinks ? 'lutimes' : 'utimes';
const name = resolveLinks ? 'utimes' : 'lutimes';
const message = (<any>error).message.trim().replace(/\.$/, '');
throw new Error(`${message}, ${name} '${path}'`);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ describe('Errors', function() {
const filePath = path.join(tempDir, 'nonexistent-file');

await (async () => {
const error = await utils.invoke(filePath, { atime: 447775200000 }, false);
const error = await utils.invoke(filePath, { atime: 447775200000 }, true);
expect(typeof error).toBe('string');

if (process.platform === 'win32') {
Expand All @@ -310,7 +310,7 @@ describe('Errors', function() {
})();

await (async () => {
const error = await utils.invokeCallback(filePath, { atime: 447775200000 });
const error = await utils.invokeCallback(filePath, { atime: 447775200000 }, false);
expect(typeof error).toBe('string');

if (process.platform === 'win32') {
Expand Down

0 comments on commit b07f861

Please sign in to comment.