anote-server-libs 0.12.2 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -141,10 +141,10 @@ function withTransaction(repo, logger, previousMethod, lock, commitIfLost = true
|
|
|
141
141
|
if (res.statusCode > 303 && res.statusCode !== 412) {
|
|
142
142
|
if (logger) {
|
|
143
143
|
if (res.statusCode > 499) {
|
|
144
|
-
logger.error('Uncaught 500 at %s %s: %j', req
|
|
144
|
+
logger.error('Uncaught 500 at %s %s: %j', req?.method, req?.originalUrl, { body: obj, stack: new Error().stack });
|
|
145
145
|
}
|
|
146
146
|
else {
|
|
147
|
-
logger.warn('Client error 4XX at %s %s: %j', req
|
|
147
|
+
logger.warn('Client error 4XX at %s %s: %j', req?.method, req?.originalUrl, { body: obj, stack: new Error().stack });
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
(repo.db ? dbClient.query('ROLLBACK') : dbClient.rollback()).catch((err) => obj && obj.error && (obj.error.additionalInfo2 = { message: err.message })).then(() => {
|
|
@@ -172,7 +172,7 @@ function withTransaction(repo, logger, previousMethod, lock, commitIfLost = true
|
|
|
172
172
|
res.end = () => {
|
|
173
173
|
if (res.statusCode > 303 && res.statusCode !== 412) {
|
|
174
174
|
if (logger && res.statusCode > 499) {
|
|
175
|
-
logger.error('Uncaught 500 with no details at %s %s: %j', req
|
|
175
|
+
logger.error('Uncaught 500 with no details at %s %s: %j', req?.method, req?.originalUrl, { stack: new Error().stack });
|
|
176
176
|
}
|
|
177
177
|
(repo.db ? dbClient.query('ROLLBACK') : dbClient.rollback()).catch(() => undefined).then(() => {
|
|
178
178
|
releaseAndDecrement(repo, dbClient);
|
|
@@ -200,7 +200,7 @@ function withTransaction(repo, logger, previousMethod, lock, commitIfLost = true
|
|
|
200
200
|
};
|
|
201
201
|
if (lock) {
|
|
202
202
|
dbClient.query('SELECT pg_advisory_xact_lock(' + lock + ')').then(() => finish()).catch((err) => {
|
|
203
|
-
logger.error('Error acquiring advisory lock %d at %s %s: %j', lock, req
|
|
203
|
+
logger.error('Error acquiring advisory lock %d at %s %s: %j', lock, req?.method, req?.originalUrl, { err, stack: new Error().stack });
|
|
204
204
|
res.status(500).json({
|
|
205
205
|
error: {
|
|
206
206
|
errorKey: 'internal.db',
|
|
@@ -215,7 +215,7 @@ function withTransaction(repo, logger, previousMethod, lock, commitIfLost = true
|
|
|
215
215
|
}
|
|
216
216
|
}).catch((err) => {
|
|
217
217
|
releaseAndDecrement(repo, dbClient);
|
|
218
|
-
logger.error('Error beginning transaction at %s %s: %j', req
|
|
218
|
+
logger.error('Error beginning transaction at %s %s: %j', req?.method, req?.originalUrl, { err, stack: new Error().stack });
|
|
219
219
|
res.status(500).json({
|
|
220
220
|
error: {
|
|
221
221
|
errorKey: 'internal.db',
|
|
@@ -225,7 +225,7 @@ function withTransaction(repo, logger, previousMethod, lock, commitIfLost = true
|
|
|
225
225
|
});
|
|
226
226
|
}).catch(err => {
|
|
227
227
|
clearTimeout(connectTimeoutHandler);
|
|
228
|
-
logger.error('Error connecting to database at %s %s: %j', req
|
|
228
|
+
logger.error('Error connecting to database at %s %s: %j', req?.method, req?.originalUrl, { err, stack: new Error().stack });
|
|
229
229
|
exports.withTransactionConfig.activeCount = Math.max(0, exports.withTransactionConfig.activeCount - 1);
|
|
230
230
|
res.status(500).json({
|
|
231
231
|
error: {
|
|
@@ -179,9 +179,9 @@ export function withTransaction(repo: BaseModelRepository, logger: Logger, previ
|
|
|
179
179
|
if(res.statusCode > 303 && res.statusCode !== 412) {
|
|
180
180
|
if(logger) {
|
|
181
181
|
if(res.statusCode > 499) {
|
|
182
|
-
logger.error('Uncaught 500 at %s %s: %j', req
|
|
182
|
+
logger.error('Uncaught 500 at %s %s: %j', req?.method, req?.originalUrl, {body: obj, stack: new Error().stack});
|
|
183
183
|
} else {
|
|
184
|
-
logger.warn('Client error 4XX at %s %s: %j', req
|
|
184
|
+
logger.warn('Client error 4XX at %s %s: %j', req?.method, req?.originalUrl, {body: obj, stack: new Error().stack});
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
(repo.db ? dbClient.query('ROLLBACK') : dbClient.rollback()).catch((err: any) => obj && obj.error && (obj.error.additionalInfo2 = {message: err.message})).then(() => {
|
|
@@ -206,7 +206,7 @@ export function withTransaction(repo: BaseModelRepository, logger: Logger, previ
|
|
|
206
206
|
res.end = () => {
|
|
207
207
|
if(res.statusCode > 303 && res.statusCode !== 412) {
|
|
208
208
|
if(logger && res.statusCode > 499) {
|
|
209
|
-
logger.error('Uncaught 500 with no details at %s %s: %j', req
|
|
209
|
+
logger.error('Uncaught 500 with no details at %s %s: %j', req?.method, req?.originalUrl, {stack: new Error().stack});
|
|
210
210
|
}
|
|
211
211
|
(repo.db ? dbClient.query('ROLLBACK') : dbClient.rollback()).catch((): any => undefined).then(() => {
|
|
212
212
|
releaseAndDecrement(repo, dbClient);
|
|
@@ -232,7 +232,7 @@ export function withTransaction(repo: BaseModelRepository, logger: Logger, previ
|
|
|
232
232
|
|
|
233
233
|
if(lock) {
|
|
234
234
|
dbClient.query('SELECT pg_advisory_xact_lock(' + lock + ')').then(() => finish()).catch((err: any) => {
|
|
235
|
-
logger.error('Error acquiring advisory lock %d at %s %s: %j', lock, req
|
|
235
|
+
logger.error('Error acquiring advisory lock %d at %s %s: %j', lock, req?.method, req?.originalUrl, {err, stack: new Error().stack});
|
|
236
236
|
res.status(500).json({
|
|
237
237
|
error: {
|
|
238
238
|
errorKey: 'internal.db',
|
|
@@ -247,7 +247,7 @@ export function withTransaction(repo: BaseModelRepository, logger: Logger, previ
|
|
|
247
247
|
}).catch((err: any) => {
|
|
248
248
|
// Error beginning transaction
|
|
249
249
|
releaseAndDecrement(repo, dbClient);
|
|
250
|
-
logger.error('Error beginning transaction at %s %s: %j', req
|
|
250
|
+
logger.error('Error beginning transaction at %s %s: %j', req?.method, req?.originalUrl, {err, stack: new Error().stack});
|
|
251
251
|
res.status(500).json({
|
|
252
252
|
error: {
|
|
253
253
|
errorKey: 'internal.db',
|
|
@@ -258,7 +258,7 @@ export function withTransaction(repo: BaseModelRepository, logger: Logger, previ
|
|
|
258
258
|
}).catch(err => {
|
|
259
259
|
// Error connecting to database for other reason than timeout or beginning transaction
|
|
260
260
|
clearTimeout(connectTimeoutHandler);
|
|
261
|
-
logger.error('Error connecting to database at %s %s: %j', req
|
|
261
|
+
logger.error('Error connecting to database at %s %s: %j', req?.method, req?.originalUrl, {err, stack: new Error().stack});
|
|
262
262
|
withTransactionConfig.activeCount = Math.max(0, withTransactionConfig.activeCount - 1);
|
|
263
263
|
res.status(500).json({
|
|
264
264
|
error: {
|