Replaced tabs with spaces
parent
c4575b21b5
commit
1a78bf8d57
|
@ -4,3 +4,6 @@
|
|||
[submodule "web/native-codec/libraries/opus"]
|
||||
path = web/native-codec/libraries/opus
|
||||
url = https://github.com/xiph/opus.git
|
||||
[submodule "vendor/TeaEventBus"]
|
||||
path = vendor/TeaEventBus
|
||||
url = https://github.com/WolverinDEV/TeaEventBus.git
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
"tc-backend/web/*": ["web/app/*"], /* specific web part */
|
||||
"tc-backend/*": ["shared/backend.d/*"],
|
||||
"tc-loader": ["loader/exports/loader.d.ts"],
|
||||
"tc-events": ["vendor/TeaEventBus/src/index.ts"],
|
||||
"tc-services": ["vendor/TeaClientServices/src/index.ts"],
|
||||
|
||||
"svg-sprites/*": ["shared/svg-sprites/*"],
|
||||
"vendor/xbbcode/*": ["vendor/xbbcode/src/*"]
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
import {MessageCommandErrorResult} from "./Messages";
|
||||
import {clientServiceLogger} from "./Logging";
|
||||
|
||||
export type ActionResult<T> = {
|
||||
unwrap() : T;
|
||||
} & ({
|
||||
status: "success",
|
||||
result: T
|
||||
} | {
|
||||
status: "error",
|
||||
result: MessageCommandErrorResult
|
||||
});
|
||||
|
||||
|
||||
export function createErrorResult<T>(result: MessageCommandErrorResult) : ActionResult<T> {
|
||||
return {
|
||||
status: "error",
|
||||
result: result,
|
||||
unwrap(): T {
|
||||
clientServiceLogger.logError("Tried to unwrap an action which failed: %o", result);
|
||||
throw "action failed with " + result.type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createResult<T>(result: T) : ActionResult<T> {
|
||||
return {
|
||||
status: "success",
|
||||
result: result,
|
||||
unwrap(): T {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 9caad3399af830606e25e66f51ee40239bc3b457
|
|
@ -230,7 +230,9 @@ export const config = async (target: "web" | "client"): Promise<Configuration> =
|
|||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js', ".scss", ".css", ".wasm"],
|
||||
alias: {
|
||||
"vendor/xbbcode": path.resolve(__dirname, "vendor/xbbcode/src")
|
||||
"vendor/xbbcode": path.resolve(__dirname, "vendor/xbbcode/src"),
|
||||
"tc-events": path.resolve(__dirname, "vendor/TeaEventBus/src/index.ts"),
|
||||
"tc-services": path.resolve(__dirname, "vendor/TeaClientServices/src/index.ts"),
|
||||
},
|
||||
},
|
||||
externals: [
|
||||
|
|
Loading…
Reference in New Issue