1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-12-11 12:04:47 +02:00

replaced .* errors with constructors and added apisBinds tests

This commit is contained in:
Gani Georgiev
2023-06-23 22:20:13 +03:00
parent 1d20124467
commit 9bfcdd086a
4 changed files with 161 additions and 38 deletions

View File

@@ -244,9 +244,28 @@ declare class ApiError implements apis.ApiError {
constructor(status?: number, message?: string, data?: any)
}
interface NotFoundError extends apis.NotFoundError{} // merge
declare class NotFoundError implements apis.NotFoundError {
constructor(message?: string, data?: any)
}
interface BadRequestError extends apis.BadRequestError{} // merge
declare class BadRequestError implements apis.BadRequestError {
constructor(message?: string, data?: any)
}
interface ForbiddenError extends apis.ForbiddenError{} // merge
declare class ForbiddenError implements apis.ForbiddenError {
constructor(message?: string, data?: any)
}
interface UnauthorizedError extends apis.UnauthorizedError{} // merge
declare class UnauthorizedError implements apis.UnauthorizedError {
constructor(message?: string, data?: any)
}
declare namespace $apis {
let requireRecordAuth: apis.requireRecordAuth
let requireSameContextRecordAuth: apis.requireSameContextRecordAuth
let requireAdminAuth: apis.requireAdminAuth
let requireAdminAuthOnlyIfAny: apis.requireAdminAuthOnlyIfAny
let requireAdminOrRecordAuth: apis.requireAdminOrRecordAuth
@@ -256,10 +275,6 @@ declare namespace $apis {
let recordAuthResponse: apis.recordAuthResponse
let enrichRecord: apis.enrichRecord
let enrichRecords: apis.enrichRecords
let notFoundError: apis.newNotFoundError
let badRequestError: apis.newBadRequestError
let forbiddenError: apis.newForbiddenError
let unauthorizedError: apis.newUnauthorizedError
}
`