add error handling

This commit is contained in:
Namrata Jha
2021-12-22 15:30:35 +00:00
committed by GitHub
parent 324039ba0a
commit 372546727d
2 changed files with 12 additions and 0 deletions
+8
View File
@@ -52,6 +52,14 @@ export function getRateLimit(token: string): Observable<RateLimitResponse> {
Accept: 'application/vnd.github.package-deletes-preview+json'
}
}) as Promise<RateLimitResponse>
).pipe(
catchError(err => {
return throwError(
err.errors && err.errors.length > 0
? `${err.errors[0].message}`
: `unknown error`
)
})
)
}