Skip to content

Commit

Permalink
Merge branch 'release/2.0.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
claytonsilva committed Feb 25, 2017
2 parents 62999ef + 31f7c4e commit af5b21c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class Application {
if (!(err instanceof Services.APIError)) {
err = new Services.APIError(err, err.status || err.statusCode || 500)
}
res.status(err.statusCode).json(err.error)
return res.status(err.statusCode >= 100 && err.statusCode < 600 ? err.statusCode : 500).json(err.error)
})
}

Expand All @@ -122,7 +122,7 @@ export class Application {
if (!(err instanceof Services.APIError)) {
err = new Services.APIError(err, err.status || err.statusCode || 500)
}
res.status(err.statusCode).json(err.error)
return res.status(err.statusCode >= 100 && err.statusCode < 600 ? err.statusCode : 500).json(err.error)
})
return app
}
Expand Down
2 changes: 1 addition & 1 deletion lib/auth/passport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const jwtGenerator = (store: JSData.DataStore, appConfig: AppConfig) => (
.catch((err: Error) => {
// throw new APIError(err, 401)
let { statusCode, error } = new APIError(err.message, 401)
return res.status(statusCode).json(error)
return res.status(statusCode >= 100 && statusCode < 600 ? statusCode : 500).json(error)
})
} else {
throw new APIError('Invalid fields', 401)
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/base-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class BaseRouter {
respond ( t: Promise<any>, res: Response ): Promise<Response> {
return t
.then(( u ) => res.json( u ) )
.catch(( err: APIError ) => res.status( err.statusCode ).json( { error: err.error, objectResponse: err.objectResponse }) )
.catch(( err: APIError ) => res.status(err.statusCode >= 100 && err.statusCode < 600 ? err.statusCode : 500).json( { error: err.error, objectResponse: err.objectResponse }) )
.catch(( err: Error ) => res.status( 500 ).json( err.message ) )
.catch(( err ) => res.status( 500 ).json( err ) )
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "js-data-dao",
"main": "lib/index.js",
"typings": "lib/index.ts",
"version": "2.0.10",
"version": "2.0.11",
"description": "js-data-dao",
"license": "MIT",
"repository": "https://github.com/xdevelsistemas/js-data-dao",
Expand Down

0 comments on commit af5b21c

Please sign in to comment.