Skip to content

Commit

Permalink
refactor: throw typeerror if checking type (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Jan 28, 2025
1 parent e7d3de4 commit 69aa8c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async function fastifyStatic (fastify, opts) {

if (opts.serve !== false) {
if (opts.wildcard && typeof opts.wildcard !== 'boolean') {
throw new Error('"wildcard" option must be a boolean')
throw new TypeError('"wildcard" option must be a boolean')
}
if (opts.wildcard === undefined || opts.wildcard === true) {
fastify.route({
Expand Down
2 changes: 1 addition & 1 deletion lib/dirList.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const dirList = {
*/
send: async function ({ reply, dir, options, route, prefix, dotfiles }) {
if (reply.request.query.format === 'html' && typeof options.render !== 'function') {
throw new Error('The `list.render` option must be a function and is required with the URL parameter `format=html`')
throw new TypeError('The `list.render` option must be a function and is required with the URL parameter `format=html`')
}

let entries
Expand Down

0 comments on commit 69aa8c7

Please sign in to comment.