Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #399 from nearform/startup-error
Browse files Browse the repository at this point in the history
Added error handling for server startup
  • Loading branch information
piccoloaiutante committed May 26, 2017
2 parents 76e30fb + 6281d54 commit 270ebef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/core/lib/mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function mapTeamList (row) {
description: row.description,
path: row.path,
organizationId: row.org_id,
usersCount: parseInt(row.users_count)
usersCount: parseInt(row.users_count, 10)
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/core/lib/ops/teamOps.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function loadTeamUsers (job, next) {
job.client.query(sql, function (err, result) {
if (err) return next(Boom.badImplementation(err))

job.totalUsersCount = result.rowCount > 0 ? parseInt(result.rows[0].total_users_count) : 0
job.totalUsersCount = result.rowCount > 0 ? parseInt(result.rows[0].total_users_count, 10) : 0
job.team.usersCount = result.rowCount
job.team.users = result.rows.map(mapping.user.simple)
next()
Expand Down
6 changes: 5 additions & 1 deletion lib/server/start.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

const Server = require('./index')
Server.start(() => {
Server.start((err) => {
if (err) {
return console.log(`Failed to start server: ${err.message}`)
}

console.log('Server started on: ' + Server.info.uri.toLowerCase())
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "udaru",
"version": "2.0.1",
"version": "2.0.2",
"description": "A policy based authorization module",
"license": "MIT",
"author": "nearForm Ltd",
Expand Down

0 comments on commit 270ebef

Please sign in to comment.