Skip to content

Commit 933599f

Browse files
authored
Merge pull request #5 from lopesboa/develop
Develop
2 parents 0bf1a1f + 7f0f683 commit 933599f

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/Presentation/Errors/error-base.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { IErrorWithCause } from "../Interfaces"
2+
3+
export class ErrorBase<T extends string> extends Error {
4+
public name: T;
5+
public message: string;
6+
public cause: any;
7+
8+
constructor(private readonly error: IErrorWithCause<T>) {
9+
super();
10+
this.name = this.error.name;
11+
this.message = this.error.message;
12+
this.cause = this.error.cause;
13+
}
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface IErrorWithCause<T> {
2+
name: T;
3+
message: string;
4+
cause: any;
5+
}

src/Presentation/Interfaces/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './error-base'

0 commit comments

Comments
 (0)