🥅 fix: add error handling for GitHub auth request
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 29s
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 29s
This commit is contained in:
@ -1,12 +1,22 @@
|
|||||||
import { Context } from "elysia";
|
import { Context } from "elysia";
|
||||||
import { returnReadResponse } from "../../../helpers/callback/httpResponse";
|
import { returnReadResponse } from "../../../helpers/callback/httpResponse";
|
||||||
import { githubRequestService } from "../services/http/githubRequest.service";
|
import { githubRequestService } from "../services/http/githubRequest.service";
|
||||||
|
import { mainErrorHandler } from "../../../helpers/error/handler";
|
||||||
|
|
||||||
export const githubRequestController = async (
|
export const githubRequestController = async (
|
||||||
ctx: Context & { query: { callback?: string } }
|
ctx: Context & { query: { callback?: string } },
|
||||||
) => {
|
) => {
|
||||||
const loginUrl = await githubRequestService(ctx.query.callback);
|
try {
|
||||||
return returnReadResponse(ctx.set, 200, "Login URL generated successfully", {
|
const loginUrl = await githubRequestService(ctx.query.callback);
|
||||||
endpointUrl: loginUrl,
|
return returnReadResponse(
|
||||||
});
|
ctx.set,
|
||||||
|
200,
|
||||||
|
"Login URL generated successfully",
|
||||||
|
{
|
||||||
|
endpointUrl: loginUrl,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
return mainErrorHandler(ctx.set, error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user