mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Add UnavailableError and keep the PermissionError name
Host not connected, host shutting down and instance not running are now UnavailableError (503) instead of ConflictError. The request error migration notes move to a new 2.1 guide, since this ships in 2.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1c7c00b033
commit
54e9340e61
23 files changed
+78
-66
No files matched your search
@@ -162,7 +162,7 @@ export interface IUser extends UserDetails {
|
||||
*
|
||||
* @param permission - The permission to check for.
|
||||
* @throws {Error} If the given permission does not exist.
|
||||
* @throws {libErrors.PermissionDeniedError} if the user does noh have the given permission.
|
||||
* @throws {libErrors.PermissionError} if the user does noh have the given permission.
|
||||
*/
|
||||
checkPermission(permission: PermissionName): void
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export class ForbiddenError extends ClientError { }
|
||||
/**
|
||||
* Thrown when a permission check fails
|
||||
*/
|
||||
export class PermissionDeniedError extends ForbiddenError { }
|
||||
export class PermissionError extends ForbiddenError { }
|
||||
|
||||
/**
|
||||
* Thrown when a config field is not accessible from the current location
|
||||
@@ -68,7 +68,7 @@ export class TimeoutError extends ClientError { }
|
||||
|
||||
/**
|
||||
* Thrown when the request conflicts with the current state, such as an
|
||||
* instance that is running or a host that is not connected (HTTP 409)
|
||||
* instance that is running or a name that is taken (HTTP 409)
|
||||
*/
|
||||
export class ConflictError extends ClientError { }
|
||||
|
||||
@@ -84,6 +84,12 @@ export class ServerError extends Error { }
|
||||
*/
|
||||
export class InternalServerError extends ServerError { }
|
||||
|
||||
/**
|
||||
* Thrown when the host or instance that should handle the request is not
|
||||
* connected, not running or shutting down (HTTP 503)
|
||||
*/
|
||||
export class UnavailableError extends ServerError { }
|
||||
|
||||
/**
|
||||
* Signal for messages that fail validation
|
||||
*/
|
||||
|
||||
@@ -348,7 +348,7 @@ export class Link {
|
||||
*
|
||||
* @param message - Message to check.
|
||||
* @param entry - Request or Event entry for this Message.
|
||||
* @throws {libErrors.PermissionDeniedError} if unauthorized.
|
||||
* @throws {libErrors.PermissionError} if unauthorized.
|
||||
*/
|
||||
validatePermission(message: libData.MessageRequest | libData.MessageEvent, entry: RequestEntry | EventEntry) { }
|
||||
|
||||
|
||||
@@ -164,13 +164,14 @@ export const errorClasses: ErrorClass[] = [
|
||||
errors.InvalidValueError,
|
||||
errors.InvalidFieldError,
|
||||
errors.ForbiddenError,
|
||||
errors.PermissionDeniedError,
|
||||
errors.PermissionError,
|
||||
errors.InvalidAccessError,
|
||||
errors.NotFoundError,
|
||||
errors.TimeoutError,
|
||||
errors.ConflictError,
|
||||
errors.ServerError,
|
||||
errors.InternalServerError,
|
||||
errors.UnavailableError,
|
||||
errors.InvalidMessage,
|
||||
errors.SessionLost,
|
||||
];
|
||||
Reference in new issue
Block a user