mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Refactor server errors handler
This commit is contained in:
@@ -6,6 +6,7 @@ export * from './debug.model'
|
||||
export * from './emailer.model'
|
||||
export * from './job.model'
|
||||
export * from './log-level.type'
|
||||
export * from './peertube-problem-document.model'
|
||||
export * from './server-config.model'
|
||||
export * from './server-debug.model'
|
||||
export * from './server-error-code.enum'
|
||||
|
||||
32
shared/models/server/peertube-problem-document.model.ts
Normal file
32
shared/models/server/peertube-problem-document.model.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { HttpStatusCode } from '@shared/core-utils'
|
||||
import { OAuth2ErrorCode, ServerErrorCode } from './server-error-code.enum'
|
||||
|
||||
export interface PeerTubeProblemDocumentData {
|
||||
'invalid-params'?: Record<string, Object>
|
||||
|
||||
originUrl?: string
|
||||
|
||||
keyId?: string
|
||||
|
||||
targetUrl?: string
|
||||
|
||||
actorUrl?: string
|
||||
|
||||
// Feeds
|
||||
format?: string
|
||||
url?: string
|
||||
}
|
||||
|
||||
export interface PeerTubeProblemDocument extends PeerTubeProblemDocumentData {
|
||||
type: string
|
||||
title: string
|
||||
|
||||
detail: string
|
||||
// Compat PeerTube <= 3.2
|
||||
error: string
|
||||
|
||||
status: HttpStatusCode
|
||||
|
||||
docs?: string
|
||||
code?: ServerErrorCode | OAuth2ErrorCode
|
||||
}
|
||||
@@ -48,5 +48,13 @@ export const enum OAuth2ErrorCode {
|
||||
*
|
||||
* @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-client-error.js
|
||||
*/
|
||||
INVALID_CLIENT = 'invalid_client'
|
||||
INVALID_CLIENT = 'invalid_client',
|
||||
|
||||
|
||||
/**
|
||||
* The access token provided is expired, revoked, malformed, or invalid for other reasons
|
||||
*
|
||||
* @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-token-error.js
|
||||
*/
|
||||
INVALID_TOKEN = 'invalid_token',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user