feat(integration): add github app authentication (#3968)
This commit is contained in:
@@ -3,3 +3,4 @@ export * from "./fetch-http-error-handler";
|
||||
export * from "./ofetch-http-error-handler";
|
||||
export * from "./axios-http-error-handler";
|
||||
export * from "./tsdav-http-error-handler";
|
||||
export * from "./octokit-http-error-handler";
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { RequestError as OctokitRequestError } from "octokit";
|
||||
|
||||
import type { AnyRequestError } from "../request-error";
|
||||
import { ResponseError } from "../response-error";
|
||||
import { HttpErrorHandler } from "./http-error-handler";
|
||||
|
||||
export class OctokitHttpErrorHandler extends HttpErrorHandler {
|
||||
/**
|
||||
* I wasn't able to get a request error triggered. Therefore we ignore them for now
|
||||
* and just forward them as unknown errors
|
||||
*/
|
||||
handleRequestError(_: unknown): AnyRequestError | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
handleResponseError(error: unknown): ResponseError | undefined {
|
||||
if (!(error instanceof OctokitRequestError)) return undefined;
|
||||
|
||||
return new ResponseError({
|
||||
status: error.status,
|
||||
url: error.response?.url,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user