File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed
packages/neuron-ui/src/exceptions Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ import { ErrorCode } from 'utils/const'
2+
3+ export class FieldInvalidException extends Error {
4+ public code = ErrorCode . FieldInvalid
5+ public i18n : {
6+ fieldName : string
7+ }
8+
9+ constructor ( fieldName : string ) {
10+ super ( `messages.codes.${ ErrorCode . FieldInvalid } ` )
11+ this . i18n = {
12+ fieldName,
13+ }
14+ }
15+ }
16+
17+ export class FieldRequiredException extends Error {
18+ public code = ErrorCode . FieldRequired
19+ public i18n : {
20+ fieldName : string
21+ }
22+
23+ constructor ( fieldName : string ) {
24+ super ( `messages.codes.${ ErrorCode . FieldRequired } ` )
25+ this . i18n = { fieldName }
26+ }
27+ }
28+
29+ export class FieldTooLongException extends Error {
30+ public code = ErrorCode . FieldTooLong
31+ public i18n : {
32+ fieldName : string
33+ length : number
34+ }
35+
36+ constructor ( fieldName : string , length : number ) {
37+ super ( `messages.codes.${ ErrorCode . FieldTooLong } ` )
38+ this . i18n = {
39+ fieldName,
40+ length,
41+ }
42+ }
43+ }
44+
45+ export class FieldUsedException extends Error {
46+ public code = ErrorCode . FieldUsed
47+ public i18n : {
48+ fieldName : string
49+ }
50+
51+ constructor ( fieldName : string ) {
52+ super ( `messages.codes.${ ErrorCode . FieldUsed } ` )
53+ this . i18n = {
54+ fieldName,
55+ }
56+ }
57+ }
58+
59+ export class AmountNotEnoughException extends Error {
60+ public code = ErrorCode . AmountNotEnough
61+ constructor ( ) {
62+ super ( `messages.codes.${ ErrorCode . AmountNotEnough } ` )
63+ }
64+ }
65+
66+ export default undefined
You can’t perform that action at this time.
0 commit comments