MCPcopy Create free account
hub / github.com/chhoumann/quickadd / loadConditionalScript

Method loadConditionalScript

src/engine/MacroChoiceEngine.ts:782–807  ·  view source on GitHub ↗
(
		condition: ScriptCondition
	)

Source from the content-addressed store, hash-verified

780 }
781
782 private async loadConditionalScript(
783 condition: ScriptCondition
784 ): Promise<ConditionalScriptRunner | undefined> {
785 try {
786 const script = await getUserScript(
787 this.buildConditionalUserScript(condition),
788 this.app
789 );
790
791 if (script === undefined || script === null) {
792 return undefined;
793 }
794
795 if (typeof script === "function") {
796 return async () => await script(this.params);
797 }
798
799 return async () => script;
800 } catch (error) {
801 reportError(
802 error,
803 `Failed to load conditional script '${condition.scriptPath}'.`
804 );
805 throw error;
806 }
807 }
808
809 private buildConditionalUserScript(
810 condition: ScriptCondition

Callers 1

Calls 3

reportErrorFunction · 0.90
getUserScriptFunction · 0.85

Tested by

no test coverage detected