Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Card } from "../src/card.ts";
import { CONSTANTS, parseParams } from "../src/utils.ts";
import { COLORS, Theme } from "../src/theme.ts";
import { Error400 } from "../src/error_page.ts";
import { Error200 } from "../src/error_page.ts";
import "https://deno.land/x/[email protected]/load.ts";
import { staticRenderRegeneration } from "../src/StaticRenderRegeneration/index.ts";
import { GithubRepositoryService } from "../src/Repository/GithubRepository.ts";
Expand Down Expand Up @@ -63,7 +63,7 @@ async function app(req: Request): Promise<Response> {

if (username === null) {
const [base] = req.url.split("?");
const error = new Error400(
const error = new Error200(
`<section>
<div>
<h2>"username" is a required query parameter</h2>
Expand Down
9 changes: 8 additions & 1 deletion src/error_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ abstract class BaseError {
<html lang="en"><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-adsense-account" content="ca-pub-7387527627218970">
<title>GitHub Profile Trophy</title>
<meta name="description" content="🏆 Add dynamically generated GitHub Stat Trophies on your readme">
<style>
Expand Down Expand Up @@ -101,9 +102,10 @@ abstract class BaseError {
}
}
</style>
<script async="async" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7387527627218970" crossorigin="anonymous"></script>
</head>
<body>
<h1 style="text-align: center;">${this.status} - ${this.message}</h1>
<h1 style="text-align: center;">${this.message}</h1>
<p style="text-align: center;">${this.content ?? ""}</p>
${
this.content &&
Expand All @@ -114,6 +116,11 @@ abstract class BaseError {
}
}

export class Error200 extends BaseError {
readonly status = 200;
readonly message = "";
}

export class Error400 extends BaseError {
readonly status = 400;
readonly message = "Bad Request";
Expand Down