-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a3f65f
commit 33b06d6
Showing
9 changed files
with
173 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { MediaSource } from './domain'; | ||
export { MediaSourceDataFormat } from './enum'; | ||
export { MediaSourceService } from './service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { MediaSourceForSyncNotFoundLoggableException } from './media-source-for-sync-not-found-loggable.exception'; | ||
export { MediaSourceBasicAuthConfigNotFoundLoggableException } from './media-source-basic-auth-config-not-found-loggable.exception'; |
34 changes: 34 additions & 0 deletions
34
...media-source/loggable/media-source-basic-auth-config-not-found-loggable.exception.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { mediaSourceFactory } from '@modules/media-source/testing'; | ||
import { MediaSourceBasicAuthConfigNotFoundLoggableException } from './media-source-basic-auth-config-not-found-loggable.exception'; | ||
|
||
describe(MediaSourceBasicAuthConfigNotFoundLoggableException.name, () => { | ||
describe('getLogMessage', () => { | ||
const setup = () => { | ||
const mediaSource = mediaSourceFactory.build(); | ||
const exception = new MediaSourceBasicAuthConfigNotFoundLoggableException( | ||
mediaSource.id, | ||
mediaSource.name as string | ||
); | ||
|
||
return { | ||
mediaSource, | ||
exception, | ||
}; | ||
}; | ||
|
||
it('should return the correct log message', () => { | ||
const { mediaSource, exception } = setup(); | ||
|
||
const logMessage = exception.getLogMessage(); | ||
|
||
const mediaSourceName = mediaSource.name as string; | ||
expect(logMessage).toEqual({ | ||
message: `Required basic auth config of media source ${mediaSourceName} is missing.`, | ||
data: { | ||
mediaSourceId: mediaSource.id, | ||
mediaSourceName, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
...ules/media-source/loggable/media-source-basic-auth-config-not-found-loggable.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NotFoundException } from '@nestjs/common'; | ||
import { ErrorLogMessage, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; | ||
|
||
export class MediaSourceBasicAuthConfigNotFoundLoggableException extends NotFoundException { | ||
constructor(private readonly mediaSourceId: string, private readonly mediaSourceName: string) { | ||
super(); | ||
} | ||
|
||
public getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage { | ||
return { | ||
message: `Required basic auth config of media source ${this.mediaSourceName} is missing.`, | ||
data: { | ||
mediaSourceId: this.mediaSourceId, | ||
mediaSourceName: this.mediaSourceName, | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.