-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(sdl): change validation error name
- Loading branch information
1 parent
eb7ee8e
commit cdc7380
Showing
6 changed files
with
50 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ValidationError } from "./ValidationError"; | ||
|
||
export class SdlValidationError extends ValidationError { | ||
static assert(condition: unknown, message: string): asserts condition { | ||
if (!condition) { | ||
throw new SdlValidationError(message); | ||
} | ||
} | ||
|
||
constructor(message: string) { | ||
super(message); | ||
this.name = "SdlValidationError"; | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
src/error/CustomValidationError.ts → src/error/ValidationError.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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
export class CustomValidationError extends Error { | ||
export class ValidationError extends Error { | ||
static assert(condition: unknown, message: string): asserts condition { | ||
if (!condition) { | ||
throw new CustomValidationError(message); | ||
throw new ValidationError(message); | ||
} | ||
} | ||
|
||
constructor(message: string) { | ||
super(message); | ||
this.name = "CustomValidationError"; | ||
this.name = "SdlValidationError"; | ||
} | ||
} |
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 @@ | ||
export * from "./CustomValidationError"; | ||
export * from "./SdlValidationError"; |
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