Edits history of script submission #5944 for ' Set default error or recoevery handler (windmill)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    /**
     * Set default error or recoevery handler
     *
     */
    export async function main(
      workspace: string,
      body: {
        handler_type: "error" | "recovery";
        override_existing: boolean;
        path?: string;
        extra_args?: { [k: string]: unknown };
        number_of_occurence?: number;
        number_of_occurence_exact?: boolean;
        workspace_handler_muted?: boolean;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(
        `${BASE_URL}/api/w/${workspace}/schedules/setdefaulthandler`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + WM_TOKEN,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 370 days ago

  • nativets
    /**
     * Set default error or recoevery handler
     *
     */
    export async function main(
      workspace: string,
      body: {
        handler_type: "error" | "recovery";
        override_existing: boolean;
        path?: string;
        extra_args?: { [k: string]: unknown };
        number_of_occurence?: number;
        number_of_occurence_exact?: boolean;
        workspace_handler_muted?: boolean;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(
        `${BASE_URL}/api/w/${workspace}/schedules/setdefaulthandler`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + WM_TOKEN,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 797 days ago