Skip to content

Commit 404f0e8

Browse files
vCiKvJustintime50
andauthored
Enhance FieldError with code and suggestion properties (#545)
# Description Adds `IAddressVerificationFieldError` interface and replaces the `errors` key of `Verification` with it as it's the proper type. Adds missing `suggestion` to `IFieldError` # Testing Just added optional types # Pull Request Type Please select the option(s) that are relevant to this PR. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] Improvement (fixing a typo, updating readme, renaming a variable name, etc) --------- Co-authored-by: Justintime50 <39606064+Justintime50@users.noreply.github.com>
1 parent 695d9b9 commit 404f0e8

5 files changed

Lines changed: 37 additions & 2 deletions

File tree

audit-ci.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
"GHSA-2g4f-4pwh-qvx6",
99
"GHSA-3ppc-4f35-3m26",
1010
"GHSA-mw96-cpmx-2vgc",
11+
"GHSA-23c5-xmqv-rm74",
12+
"GHSA-5c6j-r48x-rmvq",
13+
"GHSA-7r86-cg39-jmmj",
1114
],
1215
}

types/Address/Verification.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IFieldError } from '../errors';
1+
import { IAddressVerificationFieldError } from '../errors';
22
import { IVerificationDetails } from './VerificationDetails';
33

44
/**
@@ -13,7 +13,7 @@ export declare interface IVerification {
1313
/**
1414
* All errors that caused the verification to fail
1515
*/
16-
errors: IFieldError[];
16+
errors: IAddressVerificationFieldError[];
1717

1818
/**
1919
* Extra data related to the verification
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { TErrorCode } from './ErrorCode';
2+
3+
/**
4+
* @see https://docs.easypost.com/docs/errors#addressverificationfielderror-object
5+
*/
6+
export declare interface IAddressVerificationFieldError {
7+
/**
8+
* Machine readable description of the problem
9+
*/
10+
code: TErrorCode;
11+
12+
/**
13+
* Field of the request that the error describes
14+
*/
15+
field: string;
16+
17+
/**
18+
* Human readable description of the problem
19+
*/
20+
message: string;
21+
22+
/**
23+
* Occasional insight on how to correct the error
24+
*/
25+
suggestion?: string;
26+
}

types/errors/FieldError.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ export declare interface IFieldError {
88
* Human readable description of the problem
99
*/
1010
message: string;
11+
12+
/**
13+
* Occasional insight on how to correct the error
14+
*/
15+
suggestion?: string;
1116
}

types/errors/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './AddressVerificationFieldError';
12
export * from './Error';
23
export * from './ErrorCode';
34
export * from './FieldError';

0 commit comments

Comments
 (0)