* Throw the correct error depending on what's wrong with the type attribute. * @param {string} url The resolved URL for the module to be imported * @param {string} type The value of the import attributes' `type` property
(url, type)
| 97 | * @param {string} type The value of the import attributes' `type` property |
| 98 | */ |
| 99 | function handleInvalidType(url, type) { |
| 100 | // `type` might have not been a string. |
| 101 | validateString(type, 'type'); |
| 102 | |
| 103 | // `type` might not have been one of the types we understand. |
| 104 | if (!ArrayPrototypeIncludes(supportedTypeAttributes, type)) { |
| 105 | throw new ERR_IMPORT_ATTRIBUTE_UNSUPPORTED('type', type, url); |
| 106 | } |
| 107 | |
| 108 | // `type` was the wrong value for this format. |
| 109 | throw new ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE(url, type); |
| 110 | } |
| 111 | |
| 112 | |
| 113 | module.exports = { |
no outgoing calls
no test coverage detected
searching dependent graphs…