Skip to content

Commit 389c3c8

Browse files
committed
Errors should not should "Error: " twice for an error message.
Using the command line: office-addin-manifest modify test\manifests\manifest.xml The output was appearing as: Error: Error: You need to specify something to change in the manifest. Fixed so the output appears as: Error: You need to specify something to change in the manifest.
1 parent 58d0dca commit 389c3c8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/office-addin-manifest/src/commands.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ export async function info(manifestPath: string) {
99
const manifest = await manifestInfo.readManifestFile(manifestPath);
1010
logManifestInfo(manifestPath, manifest);
1111
} catch (err) {
12-
console.error(`Error: ${err}`);
12+
logErrorMessage(err);
1313
}
1414
}
1515

16+
function logErrorMessage(err: any) {
17+
console.error(`Error: ${err instanceof Error ? err.message : err}`);
18+
}
19+
1620
function logManifestInfo(manifestPath: string, manifest: manifestInfo.ManifestInfo) {
1721
console.log(`Manifest: ${manifestPath}`);
1822
console.log(` Id: ${manifest.id || ""}`);
@@ -36,6 +40,6 @@ export async function modify(manifestPath: string, command: commnder.Command) {
3640
const manifest = await manifestInfo.modifyManifestFile(manifestPath, guid, displayName);
3741
logManifestInfo(manifestPath, manifest);
3842
} catch (err) {
39-
console.error(`Error: ${err}`);
43+
logErrorMessage(err);
4044
}
4145
}

0 commit comments

Comments
 (0)