fix(windows): report the enforced shortcut parser limit (#12661)

This commit is contained in:
morluto authored and GitHub committed 2026-11-20 01:38:27 +00:00
1 parent 484bdc183a
commit 273f048a55
5 files changed
+126 -45

No files matched your search

+16 -5
View File
@@ -1,3 +1,5 @@
import { ParseFailureError } from "../../domain/parseFailure.js";
/** Caller-selected budgets that bound Shell Link expansion. */
export type WindowsShortcutSelectedBoundary =
| "id_list_items"
@@ -5,13 +7,22 @@ export type WindowsShortcutSelectedBoundary =
| "string_bytes";
/** Resource boundary exceeded while walking a Shell Link file. */
export class WindowsShortcutResourceFailure extends Error {
export class WindowsShortcutResourceFailure extends ParseFailureError<"limit"> {
declare readonly failure: ParseFailureError<"limit">["failure"] & {
readonly limit: { readonly name: WindowsShortcutSelectedBoundary };
};
constructor(
readonly boundary: WindowsShortcutSelectedBoundary,
readonly maximum: number,
message: string,
boundary: WindowsShortcutSelectedBoundary,
maximum: number,
detail: string,
) {
super(message);
super({
kind: "limit",
format: "windows-shortcut",
detail,
limit: { name: boundary, maximum },
});
this.name = "WindowsShortcutResourceFailure";
}
}