add error handling
This commit is contained in:
4
dist/index.js
vendored
4
dist/index.js
vendored
@@ -206,6 +206,10 @@ function getRateLimit(token) {
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.package-deletes-preview+json'
|
||||
}
|
||||
})).pipe(operators_1.catchError(err => {
|
||||
return rxjs_1.throwError(err.errors && err.errors.length > 0
|
||||
? `${err.errors[0].message}`
|
||||
: `unknown error`);
|
||||
}));
|
||||
}
|
||||
exports.getRateLimit = getRateLimit;
|
||||
|
||||
@@ -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`
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user