Browse Source

Merge pull request #6901 from nocodb/nc-log-cleanup

refactor: use error method for logging error
pull/6930/head
Pranav C 1 year ago committed by GitHub
parent
commit
77bf743cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/nocodb/src/filters/global-exception/global-exception.filter.ts
  2. 4
      packages/nocodb/src/helpers/webhookHelpers.ts
  3. 2
      packages/nocodb/src/services/datas.service.ts

2
packages/nocodb/src/filters/global-exception/global-exception.filter.ts

@ -46,7 +46,7 @@ export class GlobalExceptionFilter implements ExceptionFilter {
this.logError(exception, request); this.logError(exception, request);
if (exception instanceof ThrottlerException) { if (exception instanceof ThrottlerException) {
this.logger.log( this.logger.warn(
`${exception.message}, Path : ${request.path}, Workspace ID : ${ `${exception.message}, Path : ${request.path}, Workspace ID : ${
(request as any).ncWorkspaceId (request as any).ncWorkspaceId
}, Project ID : ${(request as any).ncProjectId}`, }, Project ID : ${(request as any).ncProjectId}`,

4
packages/nocodb/src/helpers/webhookHelpers.ts

@ -413,14 +413,14 @@ export async function invokeWebhook(
} }
} catch (e) { } catch (e) {
if (e.response) { if (e.response) {
logger.log({ logger.error({
data: e.response.data, data: e.response.data,
status: e.response.status, status: e.response.status,
url: e.response.config?.url, url: e.response.config?.url,
message: e.message, message: e.message,
}); });
} else { } else {
logger.log(e.message, e.stack); logger.error(e.message, e.stack);
} }
if (['ERROR', 'ALL'].includes(process.env.NC_AUTOMATION_LOG_LEVEL)) { if (['ERROR', 'ALL'].includes(process.env.NC_AUTOMATION_LOG_LEVEL)) {
hookLog = { hookLog = {

2
packages/nocodb/src/services/datas.service.ts

@ -180,7 +180,7 @@ export class DatasService {
); );
} catch (e) { } catch (e) {
if (e instanceof NcBaseError) throw e; if (e instanceof NcBaseError) throw e;
this.logger.log(e); this.logger.error(e);
NcError.internalServerError( NcError.internalServerError(
'Please check server log for more details', 'Please check server log for more details',
); );

Loading…
Cancel
Save