(promise: Promise<ServiceError | T>)
| 582 | * @returns The data from the promise. |
| 583 | */ |
| 584 | export const unwrapServiceError = async <T>(promise: Promise<ServiceError | T>): Promise<T> => { |
| 585 | const data = await promise; |
| 586 | if (isServiceError(data)) { |
| 587 | throw new Error(data.message); |
| 588 | } |
| 589 | |
| 590 | return data; |
| 591 | } |
| 592 | |
| 593 | export const getRepoImageSrc = (imageUrl: string | undefined, repoId: number): string | undefined => { |
| 594 | if (!imageUrl) return undefined; |
no test coverage detected