Skip to content

Commit

Permalink
Show Output button when there are errors on action commands (#164)
Browse files Browse the repository at this point in the history
* Show Output button when there are errors on action commands
  • Loading branch information
OvidiuCode authored Dec 31, 2024
1 parent b1b941a commit 52d61c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Unreleased

- Show Output button when there are errors while running action or agent package commands
- Show datasource configuration status in the tree
- Add Data Sources to the Packages tree
- Hover (tree item) action in root element to Setup all Data Sources
Expand Down
11 changes: 5 additions & 6 deletions sema4ai/vscode-client/src/robo/actionPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,6 @@ export async function createActionPackage(agentPackage?: LocalPackageMetadataInf
} catch (err) {
const errorMsg = "Error creating Action Package at: " + targetDir;
logError(errorMsg, err, "ERR_CREATE_ACTION_PACKAGE");
OUTPUT_CHANNEL.appendLine(errorMsg);
window.showErrorMessage(errorMsg + " (see `OUTPUT > Sema4.ai` for more details).");
}
}
Expand Down Expand Up @@ -1015,7 +1014,7 @@ const buildPackage = async (workspaceDir: string, outputDir: string): Promise<st
}
);
if (!result.success) {
window.showErrorMessage(`Failed to build action package: ${result.message}`);
showErrorMessageWithShowOutputButton("Failed to build the action package");
return;
}

Expand Down Expand Up @@ -1047,7 +1046,7 @@ const uploadActionPackage = async (
}
);
if (!result.success) {
window.showErrorMessage(`Failed to upload action package: ${result.message}`);
showErrorMessageWithShowOutputButton("Failed to upload action package");
return;
}

Expand All @@ -1066,7 +1065,7 @@ const getActionPackageStatus = async (
}
);
if (!result.success) {
window.showErrorMessage(`Failed to get action package status: ${result.message}`);
showErrorMessageWithShowOutputButton("Failed to get action package status");
return;
}

Expand Down Expand Up @@ -1143,7 +1142,7 @@ const createMetadataFile = async (actionPackagePath: string, outputFilePath: str
);

if (!result.success) {
window.showErrorMessage(`Failed to create the metadata file: ${result.message}`);
showErrorMessageWithShowOutputButton("Failed to create the metadata file");
return false;
}

Expand Down Expand Up @@ -1230,7 +1229,7 @@ export const publishActionPackage = async (actionPackagePath?: vscode.Uri) => {
return;
}
} catch (error) {
window.showErrorMessage(`Failed to publish action package: ${error.message}`);
showErrorMessageWithShowOutputButton("Failed to publish action package");
return;
} finally {
try {
Expand Down
22 changes: 6 additions & 16 deletions sema4ai/vscode-client/src/robo/agentPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
getWorkspacePackages,
PackageTargetAndNameResult,
revealInExtension,
showErrorMessageWithShowOutputButton,
} from "../common";
import { ActionResult, LocalPackageMetadataInfo, PackageType, PackageYamlName } from "../protocols";
import * as roboCommands from "../robocorpCommands";
Expand Down Expand Up @@ -98,8 +99,7 @@ export const importAgentPackage = async (): Promise<void> => {
} catch (err) {
const errorMsg = "Error importing Agent Package. Target: " + targetDir + " File: " + uriResult;
logError(errorMsg, err, "ERR_IMPORT_ACTION_PACKAGE");
OUTPUT_CHANNEL.appendLine(errorMsg);
window.showErrorMessage(errorMsg + " (see `OUTPUT > Sema4.ai` for more details).");
showErrorMessageWithShowOutputButton(errorMsg);
}
};

Expand Down Expand Up @@ -133,8 +133,7 @@ export const createAgentPackage = async (): Promise<void> => {
} catch (err) {
const errorMsg = "Error creating Agent Package at: " + targetDir;
logError(errorMsg, err, "ERR_CREATE_ACTION_PACKAGE");
OUTPUT_CHANNEL.appendLine(errorMsg);
window.showErrorMessage(errorMsg + " (see `OUTPUT > Sema4.ai` for more details).");
showErrorMessageWithShowOutputButton(errorMsg);
}
};

Expand All @@ -153,10 +152,7 @@ export const packAgentPackage = async (targetDir: string): Promise<{ zipPath: st
} catch (error) {
const errorMsg = `Failed to package the agent at: ${targetDir}`;
logError(errorMsg, error, "ERR_PACK_ACTION_PACKAGE");

const detailedErrorMsg = `${errorMsg}. Please check the 'OUTPUT > Sema4.ai' for more details.`;
OUTPUT_CHANNEL.appendLine(detailedErrorMsg);
window.showErrorMessage(detailedErrorMsg);
showErrorMessageWithShowOutputButton(errorMsg);
}

return null;
Expand Down Expand Up @@ -252,10 +248,7 @@ export const updateAgentVersion = async (agentPath: string): Promise<void> => {
} catch (error) {
const errorMsg = `Failed to update the agent at: ${agentPath}`;
logError(errorMsg, error, "ERR_UPDATE_AGENT_VERSION");

const detailedErrorMsg = `${errorMsg}. Please check the 'OUTPUT > Sema4.ai' for more details.`;
OUTPUT_CHANNEL.appendLine(detailedErrorMsg);
window.showErrorMessage(detailedErrorMsg);
showErrorMessageWithShowOutputButton(errorMsg);
}
};

Expand Down Expand Up @@ -286,9 +279,6 @@ export const refreshAgentSpec = async (agentPath: string): Promise<void> => {
} catch (error) {
const errorMsg = `Failed to refresh the Agent Configuration`;
logError(errorMsg, error, "ERR_REFRESH_AGENT_SPEC");

const detailedErrorMsg = `${errorMsg}. Please check the 'OUTPUT > Sema4.ai' for more details.`;
OUTPUT_CHANNEL.appendLine(detailedErrorMsg);
window.showErrorMessage(detailedErrorMsg);
showErrorMessageWithShowOutputButton(errorMsg);
}
};

0 comments on commit 52d61c5

Please sign in to comment.