mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-23 14:32:17 +00:00
[Router] use a new UnexpectedArgumentsError
This commit is contained in:
parent
50140f785a
commit
880056d397
2 changed files with 9 additions and 1 deletions
|
@ -68,6 +68,12 @@ class NullBytesInOpError extends OError {
|
|||
}
|
||||
}
|
||||
|
||||
class UnexpectedArgumentsError extends OError {
|
||||
constructor() {
|
||||
super('unexpected arguments')
|
||||
}
|
||||
}
|
||||
|
||||
class UpdateTooLargeError extends OError {
|
||||
constructor(updateSize) {
|
||||
super('update is too large', { updateSize })
|
||||
|
@ -91,6 +97,7 @@ module.exports = {
|
|||
NotAuthorizedError,
|
||||
NotJoinedError,
|
||||
NullBytesInOpError,
|
||||
UnexpectedArgumentsError,
|
||||
UpdateTooLargeError,
|
||||
WebApiRequestFailedError
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ const HttpController = require('./HttpController')
|
|||
const HttpApiController = require('./HttpApiController')
|
||||
const bodyParser = require('body-parser')
|
||||
const base64id = require('base64id')
|
||||
const { UnexpectedArgumentsError } = require('./Errors')
|
||||
|
||||
const basicAuth = require('basic-auth-connect')
|
||||
const httpAuth = basicAuth(function (user, pass) {
|
||||
|
@ -64,7 +65,7 @@ module.exports = Router = {
|
|||
},
|
||||
|
||||
_handleInvalidArguments(client, method, args) {
|
||||
const error = new Error('unexpected arguments')
|
||||
const error = new UnexpectedArgumentsError()
|
||||
let callback = args[args.length - 1]
|
||||
if (typeof callback !== 'function') {
|
||||
callback = function () {}
|
||||
|
|
Loading…
Reference in a new issue