-
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.
Merge branch 'main' into BC-6113-modify-find-method-in-KNL-module
- Loading branch information
Showing
203 changed files
with
4,241 additions
and
815 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
3 changes: 3 additions & 0 deletions
3
apps/server/src/infra/preview-generator/interface/error-status.enum.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,3 @@ | ||
export enum ErrorType { | ||
CREATE_PREVIEW_NOT_POSSIBLE = 'CREATE_PREVIEW_NOT_POSSIBLE', | ||
} |
40 changes: 40 additions & 0 deletions
40
apps/server/src/infra/preview-generator/loggable/preview-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,40 @@ | ||
import { InternalServerErrorException } from '@nestjs/common'; | ||
import { PreviewNotPossibleException } from './preview-exception'; | ||
|
||
describe(PreviewNotPossibleException.name, () => { | ||
describe('WHEN getLogMessage is called', () => { | ||
const setup = () => { | ||
const payload = { | ||
originFilePath: 'originFilePath', | ||
previewFilePath: 'previewFilePath', | ||
previewOptions: { | ||
format: 'format', | ||
width: 100, | ||
}, | ||
}; | ||
const error = new Error('error'); | ||
|
||
return { payload, error }; | ||
}; | ||
|
||
it('should return error log message', () => { | ||
const { payload, error } = setup(); | ||
|
||
const exception = new PreviewNotPossibleException(payload, error); | ||
|
||
const result = exception.getLogMessage(); | ||
|
||
expect(result).toEqual({ | ||
type: InternalServerErrorException.name, | ||
stack: exception.stack, | ||
error, | ||
data: { | ||
originFilePath: 'originFilePath', | ||
previewFilePath: 'previewFilePath', | ||
format: 'format', | ||
width: 100, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
apps/server/src/infra/preview-generator/loggable/preview-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,27 @@ | ||
import { InternalServerErrorException } from '@nestjs/common'; | ||
import { ErrorLogMessage, Loggable } from '@src/core/logger'; | ||
import { PreviewFileOptions } from '../interface'; | ||
import { ErrorType } from '../interface/error-status.enum'; | ||
|
||
export class PreviewNotPossibleException extends InternalServerErrorException implements Loggable { | ||
constructor(private readonly payload: PreviewFileOptions, private readonly error?: Error) { | ||
super(ErrorType.CREATE_PREVIEW_NOT_POSSIBLE); | ||
} | ||
|
||
getLogMessage(): ErrorLogMessage { | ||
const { originFilePath, previewFilePath, previewOptions } = this.payload; | ||
const message: ErrorLogMessage = { | ||
type: InternalServerErrorException.name, | ||
stack: this.stack, | ||
error: this.error, | ||
data: { | ||
originFilePath, | ||
previewFilePath, | ||
format: previewOptions.format, | ||
width: previewOptions.width, | ||
}, | ||
}; | ||
|
||
return message; | ||
} | ||
} |
Oops, something went wrong.