log
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Injectable, InternalServerErrorException, OnModuleInit, UnauthorizedException } from '@nestjs/common';
|
import { Injectable, InternalServerErrorException, Logger, OnModuleInit, UnauthorizedException } from '@nestjs/common';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { HttpAdapterHost } from '@nestjs/core';
|
import { HttpAdapterHost } from '@nestjs/core';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
@@ -23,6 +23,8 @@ type JoseImport = typeof import('jose');
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OidcProviderService implements OnModuleInit {
|
export class OidcProviderService implements OnModuleInit {
|
||||||
|
private readonly logger = new Logger(OidcProviderService.name);
|
||||||
|
|
||||||
private provider?: Provider;
|
private provider?: Provider;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -303,7 +305,10 @@ export class OidcProviderService implements OnModuleInit {
|
|||||||
|
|
||||||
for (const eventName of errorEvents) {
|
for (const eventName of errorEvents) {
|
||||||
eventSource.on(eventName, (ctx, error) => {
|
eventSource.on(eventName, (ctx, error) => {
|
||||||
void this.logOidcProviderError(eventName, ctx, error);
|
this.logOidcProviderError(eventName, ctx, error).catch((logError) => {
|
||||||
|
const message = logError instanceof Error ? logError.message : String(logError);
|
||||||
|
this.logger.error(`OIDC provider error logging failed for ${eventName}: ${message}`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user