Skip to content

Commit e16fcf7

Browse files
committed
refactor: throw typeerror if checking type
1 parent e7d3de4 commit e16fcf7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async function fastifyStatic (fastify, opts) {
108108

109109
if (opts.serve !== false) {
110110
if (opts.wildcard && typeof opts.wildcard !== 'boolean') {
111-
throw new Error('"wildcard" option must be a boolean')
111+
throw new TypeError('"wildcard" option must be a boolean')
112112
}
113113
if (opts.wildcard === undefined || opts.wildcard === true) {
114114
fastify.route({

lib/dirList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const dirList = {
108108
*/
109109
send: async function ({ reply, dir, options, route, prefix, dotfiles }) {
110110
if (reply.request.query.format === 'html' && typeof options.render !== 'function') {
111-
throw new Error('The `list.render` option must be a function and is required with the URL parameter `format=html`')
111+
throw new TypeError('The `list.render` option must be a function and is required with the URL parameter `format=html`')
112112
}
113113

114114
let entries

0 commit comments

Comments
 (0)