mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Fix page format
This commit is contained in:
parent
1ea1949d86
commit
5f08ba0e98
2 changed files with 6 additions and 2 deletions
2
index.ts
2
index.ts
|
|
@ -43,7 +43,7 @@ export default async (req: Request) => {
|
|||
if (username === null) {
|
||||
const [base] = req.url.split("?");
|
||||
const error = new Error400(
|
||||
`<h2><code>username</code> is a required query parameter</h2>
|
||||
`<h2>"username" is a required query parameter</h2>
|
||||
<p>The URL should look like <code>${base}?username=USERNAME</code>, where
|
||||
<code>USERNAME</code> is <em>your GitHub username.</em>`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
abstract class BaseError {
|
||||
readonly status!: number;
|
||||
readonly message!: string;
|
||||
constructor(readonly content?: string) {}
|
||||
render(): string {
|
||||
return `<!DOCTYPE html><html><body><h1>${this.status}</h1>${this.content ?? ''}</body></html>`;
|
||||
return `<!DOCTYPE html><html><body><h1>${this.status} - ${this.message}</h1>${
|
||||
this.content ?? ""
|
||||
}</body></html>`;
|
||||
}
|
||||
}
|
||||
|
||||
export class Error400 extends BaseError {
|
||||
readonly status = 400;
|
||||
readonly message = "Bad Reuquest";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue