more oops

This commit is contained in:
Dylan Conway
2025-01-17 20:34:47 -08:00
parent 501887a824
commit 6e8a099e72
2 changed files with 11 additions and 8 deletions

View File

@@ -2542,10 +2542,13 @@ pub const Arguments = struct {
if (arguments.next()) |arg_position| {
arguments.eat();
const num: i64 = try JSC.Node.validators.validateIntegerOrBigInt(ctx, arg_position, "position", -1, 9007199254740991);
if (num >= 0)
args.position = @as(ReadPosition, @intCast(num));
if (!arg_position.isNull()) {
const num: i64 = try JSC.Node.validators.validateIntegerOrBigInt(ctx, arg_position, "position", -1, 9007199254740991);
if (num >= 0)
args.position = @as(ReadPosition, @intCast(num));
}
}
} else if (current.isObject()) {
if (try current.getTruthy(ctx, "offset")) |num| {

View File

@@ -259,7 +259,7 @@ describe("fs.watch", () => {
} catch (err: any) {
expect(err).toBeInstanceOf(Error);
expect(err.code).toBe("ENOENT");
expect(err.syscall).toBe("open");
expect(err.syscall).toBe("watch");
done();
}
});
@@ -447,10 +447,10 @@ describe("fs.watch", () => {
watcher.close();
expect.unreachable();
} catch (err: any) {
expect(err.message).toBe(`EACCES: permission denied, open '${filepath}'`);
expect(err.message).toBe(`EACCES: permission denied, watch '${filepath}'`);
expect(err.path).toBe(filepath);
expect(err.code).toBe("EACCES");
expect(err.syscall).toBe("open");
expect(err.syscall).toBe("watch");
}
});
@@ -464,10 +464,10 @@ describe("fs.watch", () => {
watcher.close();
expect.unreachable();
} catch (err: any) {
expect(err.message).toBe(`EACCES: permission denied, open '${filepath}'`);
expect(err.message).toBe(`EACCES: permission denied, watch '${filepath}'`);
expect(err.path).toBe(filepath);
expect(err.code).toBe("EACCES");
expect(err.syscall).toBe("open");
expect(err.syscall).toBe("watch");
}
});
});