Skip to content

Commit

Permalink
refactor(auth): throw typeerror if param type wrong (#248)
Browse files Browse the repository at this point in the history
* refactor(auth): throw typeerrror if param type wrong

Signed-off-by: Frazer Smith <frazer.dev@icloud.com>

* refactor(auth): another

---------

Signed-off-by: Frazer Smith <frazer.dev@icloud.com>
  • Loading branch information
Fdawgs authored Jan 10, 2025
1 parent a582f09 commit 8a53c41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function fastifyAuth (fastify, opts, next) {
function auth (pluginOptions) {
return function (functions, opts) {
if (!Array.isArray(functions)) {
throw new Error('You must give an array of functions to the auth function')
throw new TypeError('You must give an array of functions to the auth function')
}
if (!functions.length) {
throw new Error('Missing auth functions')
Expand All @@ -43,7 +43,7 @@ function auth (pluginOptions) {
} else {
for (let j = 0; j < functions[i].length; j++) {
if (Array.isArray(functions[i][j])) {
throw new Error('Nesting sub-arrays is not supported')
throw new TypeError('Nesting sub-arrays is not supported')
}
functions[i][j] = functions[i][j].bind(this)
}
Expand Down

0 comments on commit 8a53c41

Please sign in to comment.