-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(logging): handle media server connection refused error/toast (#748)
* fix(logging): handle media server connection refused error/toast Properly log as connection refused if the jellyfin/emby server is unreachable. Previously it used to throw a credentials error which lead to a lot of confusion * refactor(i8n): extract translation keys * refactor(auth): error message for a more consistent format * refactor(auth/errors): use custom error types and error codes instead of abusing error messages * refactor(i8n): replace connection refused translation key with invalidurl * fix(error): combine auth and api error class into a single one called network error * fix(error): use the new network error and network error codes in auth/api * refactor(error): rename NetworkError to ApiError
- Loading branch information
1 parent
1008229
commit f486fb5
Showing
6 changed files
with
127 additions
and
51 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
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,5 @@ | ||
export enum ApiErrorCode { | ||
InvalidUrl = 'INVALID_URL', | ||
InvalidCredentials = 'INVALID_CREDENTIALS', | ||
NotAdmin = 'NOT_ADMIN', | ||
} |
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,9 @@ | ||
import type { ApiErrorCode } from '@server/constants/error'; | ||
|
||
export class ApiError extends Error { | ||
constructor(public statusCode: number, public errorCode: ApiErrorCode) { | ||
super(); | ||
|
||
this.name = 'apiError'; | ||
} | ||
} |
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