Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fnf error reporting #2078

Merged
merged 18 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Zowe CLI package will be documented in this file.

## Recent Changes

- BugFix: Removing stack trace for zosjobs errors. [#2078](https://github.com/zowe/zowe-cli/pull/2078)

## `8.0.0-next.202403061549`

- BugFix: Update daemon dependencies for technical currency [#2077](https://github.com/zowe/zowe-cli/pull/2077)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ describe("zos-jobs submit local-file command", () => {
const response = runCliScript(__dirname + "/__scripts__/submit_invalid_local_file.sh",
TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stderr.toString().toLowerCase()).toContain("error");
expect(response.stderr.toString().toLowerCase()).toContain("no such file");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,33 @@ describe("submit shared handler", () => {
expect(error.message).toContain("Unable to determine the JCL source. Please contact support");
});

it("should return any caught error, ie: ENOENT", async () => {
// Require the handler and create a new instance
const handlerReq = require("../../../../src/zosjobs/submit/Submit.shared.handler");
const handler = new handlerReq.default();

// Vars populated by the mocked function
let error;

// Local file doesn't exist and should be cause of failure
const theLocalFile: string = "fakefile";

const copy = Object.assign({}, LOCALFILE_PARAMETERS);
copy.arguments.localFile = theLocalFile;
try {
// Invoke the handler with a full set of mocked arguments and response functions
await handler.process(copy);
} catch (e) {
error = e;
}

expect(error).toBeDefined();
expect(error).toBeInstanceOf(ImperativeError);
expect(error.message).toContain("Node.js File System API error");
expect(error.additionalDetails).toContain("ENOENT: no such file or directory, open");
expect(error.additionalDetails).toContain("fakefile");
});

it("should not transform an error thrown by the submit JCL API", async () => {
// Require the handler and create a new instance
const handlerReq = require("../../../../src/zosjobs/submit/Submit.shared.handler");
Expand Down Expand Up @@ -585,7 +612,7 @@ describe("submit shared handler", () => {

expect(error).toBeUndefined();
expect(SubmitJobs.submitJclString).toHaveBeenCalledTimes(1);
expect(copy.response.console.log).toHaveBeenCalledTimes(4);
// expect(copy.response.console.log).toHaveBeenCalledTimes(4);
t1m0thyj marked this conversation as resolved.
Show resolved Hide resolved
ATorrise marked this conversation as resolved.
Show resolved Hide resolved
expect(LocalFileSpecified).toBe(`${badJCL}`);
IO.deleteFile(theLocalFile);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,33 @@ Object {

exports[`submit shared handler process method should submit JCL contained within a local-file if requested 3`] = `"Submitted JCL contained in \\"local-file\\": \\"test.txt\\""`;

exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 1`] = `"Spool file: %s (ID #%d, Step: %s)"`;

exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 2`] = `"FakeData1"`;

exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 3`] = `"Spool file: %s (ID #%d, Step: %s)"`;

exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 4`] = `"FakeData2"`;
exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 1`] = `
Object {
"fields": Array [
"jobid",
"retcode",
"jobname",
"status",
],
"format": "object",
"output": Array [
Object {
"data": "FakeData1",
"ddName": "fakeDD1",
"id": 1,
"stepName": "fakeStep1",
},
Object {
"data": "FakeData2",
"ddName": "fakeDD2",
"id": 2,
"stepName": "fakeStep2",
},
],
}
`;

exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 5`] = `
exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 2`] = `
Array [
Object {
"data": "FakeData1",
Expand All @@ -156,7 +174,7 @@ Array [
]
`;

exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 6`] = `"Submitted JCL contained in \\"local-file\\": \\"test.txt\\""`;
exports[`submit shared handler process method should submit JCL contained within a local-file if requested and view all spool content 3`] = `"Submitted JCL contained in \\"local-file\\": \\"test.txt\\""`;

exports[`submit shared handler process method should submit JCL contained within a uss-file if requested 1`] = `
Object {
Expand Down
Loading
Loading