mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Port basic lib sub-modules to TypeScript
This commit is contained in:
1 parent
e0c197b9bc
commit
15ea9a91dc
14 files changed
+636
-488
No files matched your search
@@ -6,7 +6,9 @@
|
||||
/**
|
||||
* Thrown by commands when they fail
|
||||
*/
|
||||
export class CommandError extends Error { }
|
||||
export class CommandError extends Error {
|
||||
code: "CommandError";
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown from requests sent when an error occured handling it
|
||||
@@ -14,7 +16,7 @@ export class CommandError extends Error { }
|
||||
export class RequestError extends Error {
|
||||
constructor(
|
||||
message: string,
|
||||
public code?: string,
|
||||
public code = "RequestError",
|
||||
public stack?: string,
|
||||
) {
|
||||
super(message);
|
||||
@@ -28,12 +30,22 @@ export class RequestError extends Error {
|
||||
* requests fail due to permission denied.
|
||||
*
|
||||
*/
|
||||
export class PermissionError extends RequestError { }
|
||||
export class PermissionError extends RequestError {
|
||||
constructor(
|
||||
message: string,
|
||||
code = "PermissionError",
|
||||
stack?: string,
|
||||
) {
|
||||
super(message, code, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal for messages that fail validation
|
||||
*/
|
||||
export class InvalidMessage extends Error {
|
||||
code: "InvalidMessage";
|
||||
constructor(
|
||||
message: string,
|
||||
public errors: object = null,
|
||||
@@ -45,27 +57,36 @@ export class InvalidMessage extends Error {
|
||||
/**
|
||||
* Thrown from requests when the session it was sent on was lost
|
||||
*/
|
||||
export class SessionLost extends Error { }
|
||||
export class SessionLost extends Error {
|
||||
code: "SessionLost";
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown when WebSocket authentication failed
|
||||
*/
|
||||
export class AuthenticationFailed extends Error { }
|
||||
export class AuthenticationFailed extends Error {
|
||||
code: "AuthenticationFailed";
|
||||
}
|
||||
|
||||
/**
|
||||
* Errror class for known errors occuring during startup
|
||||
*/
|
||||
export class StartupError extends Error { }
|
||||
export class StartupError extends Error {
|
||||
code: "StartupError";
|
||||
}
|
||||
|
||||
/**
|
||||
* Errors outside of our control
|
||||
*/
|
||||
export class EnvironmentError extends Error { }
|
||||
export class EnvironmentError extends Error {
|
||||
code: "EnvironmentError";
|
||||
}
|
||||
|
||||
/**
|
||||
* Errors caused by plugins
|
||||
*/
|
||||
export class PluginError extends Error {
|
||||
code: "PluginError";
|
||||
constructor(
|
||||
public pluginName: string,
|
||||
public original: Error
|
||||
|
||||
Reference in new issue
Block a user