-
Notifications
You must be signed in to change notification settings - Fork 831
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-elevenlabs
- Loading branch information
Showing
30 changed files
with
1,616 additions
and
1,555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:22.12-alpine as builder | ||
FROM node:22.12-alpine AS builder | ||
|
||
WORKDIR /app | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
export class GitHubError extends Error { | ||
constructor( | ||
message: string, | ||
public readonly status: number, | ||
public readonly response: unknown | ||
) { | ||
super(message); | ||
this.name = "GitHubError"; | ||
} | ||
} | ||
|
||
export class GitHubValidationError extends GitHubError { | ||
constructor(message: string, status: number, response: unknown) { | ||
super(message, status, response); | ||
this.name = "GitHubValidationError"; | ||
} | ||
} | ||
|
||
export class GitHubResourceNotFoundError extends GitHubError { | ||
constructor(resource: string) { | ||
super(`Resource not found: ${resource}`, 404, { message: `${resource} not found` }); | ||
this.name = "GitHubResourceNotFoundError"; | ||
} | ||
} | ||
|
||
export class GitHubAuthenticationError extends GitHubError { | ||
constructor(message = "Authentication failed") { | ||
super(message, 401, { message }); | ||
this.name = "GitHubAuthenticationError"; | ||
} | ||
} | ||
|
||
export class GitHubPermissionError extends GitHubError { | ||
constructor(message = "Insufficient permissions") { | ||
super(message, 403, { message }); | ||
this.name = "GitHubPermissionError"; | ||
} | ||
} | ||
|
||
export class GitHubRateLimitError extends GitHubError { | ||
constructor( | ||
message = "Rate limit exceeded", | ||
public readonly resetAt: Date | ||
) { | ||
super(message, 429, { message, reset_at: resetAt.toISOString() }); | ||
this.name = "GitHubRateLimitError"; | ||
} | ||
} | ||
|
||
export class GitHubConflictError extends GitHubError { | ||
constructor(message: string) { | ||
super(message, 409, { message }); | ||
this.name = "GitHubConflictError"; | ||
} | ||
} | ||
|
||
export function isGitHubError(error: unknown): error is GitHubError { | ||
return error instanceof GitHubError; | ||
} | ||
|
||
export function createGitHubError(status: number, response: any): GitHubError { | ||
switch (status) { | ||
case 401: | ||
return new GitHubAuthenticationError(response?.message); | ||
case 403: | ||
return new GitHubPermissionError(response?.message); | ||
case 404: | ||
return new GitHubResourceNotFoundError(response?.message || "Resource"); | ||
case 409: | ||
return new GitHubConflictError(response?.message || "Conflict occurred"); | ||
case 422: | ||
return new GitHubValidationError( | ||
response?.message || "Validation failed", | ||
status, | ||
response | ||
); | ||
case 429: | ||
return new GitHubRateLimitError( | ||
response?.message, | ||
new Date(response?.reset_at || Date.now() + 60000) | ||
); | ||
default: | ||
return new GitHubError( | ||
response?.message || "GitHub API error", | ||
status, | ||
response | ||
); | ||
} | ||
} |
Oops, something went wrong.