// No need for a server, let's just spin up the schema builder (async (): Promise<void> => { const pgPool = new Pool(pgConfig); pgPool.on('error', err => { // tslint:disable-next-line no-console console.error('PostgreSQL client generated error: ', err.message); }); const { getGraphQLSchema } = getPostgraphileSchemaBuilder(pgPool, schemas, postgraphileOptions); await getGraphQLSchema(); if (!watchPg) { await pgPool.end(); } })().then(null, e => { console.error('Error occurred!'); console.error(e); process.exit(1); });
...config }); this.pool.on('error', (err) => {
pgpool.on('error', (e, c) => { console.log('pgpool error: ' + e); pgpool.end(); setTimeout(function () { pgpool = new pg.Pool(db_config); }, 100); })
async open () { this.pool = new pg.Pool(this.config) this.pool.on('error', error => this.emit('error', error)) this.opened = true }
pool.on("error", function (err, client) { // if an error is encountered by a client while it sits idle in the pool // the pool itself will emit an error event with both the error and // the client which emitted the original error // this is a rare occurrence but can happen if there is a network partition // between your application and the database, the database restarts, etc. // and so you might want to handle it and at least log it out console.error("idle client error", err.message, err.stack); });
constructor () { this._pool = new Pool({ connectionString: CONNECTION_STRING, ssl: SSL }); this._pool.on('error', (err, client) => { console.error('Unexpected error on idle PostgreSQL client.', err); process.exit(-1); }); }
pool.on('remove', () => { console.log('client removed'); process.exit(0); });
pool.on('error', (error) => { Logger.error('database pool on error =>', error); });
pool.on('connect', () => { console.log('connected to the db'); });
pool.on('connect', () => { console.log('connected to the Database'); });
pool.on('connect', () => { console.log('Base de Dados conectado com sucesso!'); });
pool.on('error', (err, client) => { console.error('Error:', err); });
pool.on("error", function (err, client) { console.error("DB Pool Error: ", err.message, err.stack); });
db.on('error', (err, client) => { logger.error(err) })