Skip to content

Commit

Permalink
fix(login): handleError was swallowing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rndlaine committed Nov 13, 2018
1 parent fb4c4e9 commit 66ff4b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bp/core/server.ts
Expand Up @@ -3,7 +3,7 @@ import { AxiosBotConfig, Logger, RouterOptions } from 'botpress/sdk'
import LicensingService from 'common/licensing-service'
import cors from 'cors'
import errorHandler from 'errorhandler'
import { InvalidParameterError, UnlicensedError } from 'errors'
import { UnlicensedError } from 'errors'
import express from 'express'
import rewrite from 'express-urlrewrite'
import { createServer, Server } from 'http'
Expand All @@ -20,7 +20,7 @@ import { GhostService } from './services'
import ActionService from './services/action/action-service'
import { AdminService } from './services/admin/service'
import AuthService from './services/auth/auth-service'
import { InvalidLicenseKey, InvalidOperationError } from './services/auth/errors'
import { InvalidLicenseKey } from './services/auth/errors'
import { CMSService } from './services/cms/cms-service'
import { FlowService } from './services/dialog/flow/service'
import { SkillService } from './services/dialog/skill/service'
Expand Down Expand Up @@ -125,7 +125,7 @@ export default class HTTPServer {
if (err instanceof UnlicensedError) {
throw new InvalidLicenseKey(err.message)
}
next()
next(err)
})

this.app.use(function handleUnexpectedError(err, req, res, next) {
Expand Down
1 change: 1 addition & 0 deletions src/bp/core/services/auth/errors.ts
Expand Up @@ -51,6 +51,7 @@ export class TokenExpiredError extends ResponseError {
export class InvalidCredentialsError extends ResponseError {
constructor(message?: string) {
super('Invalid credentials' + (message ? ' ' + message : ''), 400, 'BP_0009')
this.skipLogging = true
}

type = 'InvalidCredentialsError'
Expand Down

0 comments on commit 66ff4b3

Please sign in to comment.