Skip to content

Commit b0fed1b

Browse files
Includes invalid values in thrown errors
1 parent 1332b73 commit b0fed1b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ function format (obj) {
5252
var type = obj.type
5353

5454
if (!type || !TYPE_NAME_REGEXP.test(type)) {
55-
throw new TypeError('invalid type')
55+
throw new TypeError('invalid type \'' + type + '\'')
5656
}
5757

5858
if (!subtype || !SUBTYPE_NAME_REGEXP.test(subtype)) {
59-
throw new TypeError('invalid subtype')
59+
throw new TypeError('invalid subtype \'' + subtype + '\'')
6060
}
6161

6262
// format as type/subtype
@@ -114,7 +114,7 @@ function parse (string) {
114114
var match = TYPE_REGEXP.exec(string.toLowerCase())
115115

116116
if (!match) {
117-
throw new TypeError('invalid media type')
117+
throw new TypeError('invalid media type \''+ string + '\'')
118118
}
119119

120120
var type = match[1]

0 commit comments

Comments
 (0)