Skip to content

Commit

Permalink
Fixed spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhammedIrfan committed Jan 2, 2021
1 parent 7394514 commit 05159fa
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/exceptions/configuration.exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Exception } from './exception';
*/

export class ConfigurationException extends Exception {

constructor(description) {
super('ConfigurationException', description, false);
}
Expand Down
1 change: 0 additions & 1 deletion src/exceptions/exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

export abstract class Exception extends Error {

public readonly name: string;
public readonly isOperational: boolean | undefined;
public readonly description: string;
Expand Down
4 changes: 2 additions & 2 deletions src/middlewares/error-handler.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { createLogger, transports, format } from "winston";
*/

class ErrorHandlerMiddleware {

public async handleError(error: Exception): Promise<void> {

// Build a custom logger to handle configuration error as the logger transports will be added only after the validating the configration. Without this winston will throw `Attempt to write logs with no transports`.
if(error instanceof ConfigurationException) {
const logger = createLogger(
Expand All @@ -27,6 +25,7 @@ class ErrorHandlerMiddleware {
],
}
);

logger.log("error", error.message);
}

Expand All @@ -37,4 +36,5 @@ class ErrorHandlerMiddleware {
}
}
}

export const ErrorHandler = new ErrorHandlerMiddleware();
1 change: 0 additions & 1 deletion src/modules/configuration.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { ConfigurationException } from "@exceptions";
*/

export const ConfigurationModule: MicroframeworkLoader = (frameworkSettings: MicroframeworkSettings | undefined) => {

if (frameworkSettings) {
// Build Yup schema from the provided json schema.
const yupSchema = buildYup(jsonSchema, {});
Expand Down

0 comments on commit 05159fa

Please sign in to comment.