Skip to content

Commit d0dabde

Browse files
committed
fix: correct error message punctuation per style guide
- Add periods to Error messages for argument validation - Maintain no-period style for PurlError messages - Follows CLAUDE.md error handling patterns
1 parent b5f24fd commit d0dabde

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/objects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function recursiveFreeze<T>(value_: T): T {
2929
while (pos < queueLength) {
3030
// Safety check to prevent processing excessively large object graphs.
3131
if (pos === LOOP_SENTINEL) {
32-
throw new Error('Object graph too large (exceeds 1,000,000 items)')
32+
throw new Error('Object graph too large (exceeds 1,000,000 items).')
3333
}
3434
const obj = queue[pos++]!
3535
Object.freeze(obj)

src/package-url.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ class PackageURL {
279279

280280
// Validate parsed result is an object.
281281
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
282-
throw new Error('JSON must parse to an object')
282+
throw new Error('JSON must parse to an object.')
283283
}
284284

285285
// Cast to record type for safe property access
@@ -304,7 +304,7 @@ class PackageURL {
304304
*/
305305
static fromObject(obj: unknown): PackageURL {
306306
if (!isObject(obj)) {
307-
throw new Error('Object argument is required')
307+
throw new Error('Object argument is required.')
308308
}
309309
const typedObj = obj as Record<string, unknown>
310310
return new PackageURL(
@@ -333,7 +333,7 @@ class PackageURL {
333333
static parseString(purlStr: unknown): unknown[] {
334334
// https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst#how-to-parse-a-purl-string-in-its-components
335335
if (typeof purlStr !== 'string') {
336-
throw new Error('A purl string argument is required')
336+
throw new Error('A purl string argument is required.')
337337
}
338338
if (isBlank(purlStr)) {
339339
return [undefined, undefined, undefined, undefined, undefined, undefined]

0 commit comments

Comments
 (0)