* Creates the exception thrown by Web IDL converters. * @param {string} message Unprefixed conversion failure message. * @param {ConversionOptions} [options] Conversion options. * @returns {TypeError}
(message, options = kEmptyObject)
| 100 | * @returns {TypeError} |
| 101 | */ |
| 102 | function makeException(message, options = kEmptyObject) { |
| 103 | const prefix = options.prefix ? options.prefix + ': ' : ''; |
| 104 | const context = options.context?.length === 0 ? |
| 105 | '' : (options.context ?? 'Value') + ' '; |
| 106 | return codedTypeError( |
| 107 | `${prefix}${context}${message}`, |
| 108 | options.code || 'ERR_INVALID_ARG_TYPE', |
| 109 | ); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Builds derived conversion options for nested converter calls and adjusted |
no test coverage detected
searching dependent graphs…