| 25 | |
| 26 | export interface GooglePeopleErrorBody { |
| 27 | code: number; |
| 28 | details?: GooglePeopleErrorDetail[]; |
| 29 | message: string; |
| 30 | status: string; |
| 31 | } |
| 32 | |
| 33 | export interface GooglePeopleError { |
| 34 | error: GooglePeopleErrorBody; |
| 35 | } |
| 36 | |
| 37 | export class APIError< |
| 38 | TStatus extends number | undefined = number | undefined, |
| 39 | THeaders extends Headers | undefined = Headers | undefined, |
| 40 | TError extends GooglePeopleError | undefined = GooglePeopleError | undefined, |
| 41 | > extends Error { |
| 42 | /** HTTP status for the response that caused the error */ |
| 43 | readonly status: TStatus; |
| 44 | /** HTTP headers for the response that caused the error */ |
| 45 | readonly headers: THeaders; |
| 46 | /** JSON body of the response that caused the error */ |
| 47 | readonly error: TError; |
| 48 | |
| 49 | constructor( |
| 50 | status: TStatus, |
| 51 | error: TError, |
| 52 | message: string | undefined, |
| 53 | headers: THeaders, |