Skip to content

Commit adc40af

Browse files
committed
fix linting and tests
1 parent 753cad9 commit adc40af

File tree

8 files changed

+33
-13
lines changed

8 files changed

+33
-13
lines changed

packages/core/src/awsService/appBuilder/explorer/nodes/deployedNode.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export async function generateDeployedNode(
107107
createPlaceholderItem(
108108
localize(
109109
'AWS.appBuilder.explorerNode.unavailableDeployedResource',
110-
'[Failed to retrive deployed resource. Please ensure your AWS account is connected.]'
110+
'[Failed to retrive deployed resource. Ensure your AWS account is connected.]'
111111
)
112112
),
113113
]
@@ -156,7 +156,10 @@ export async function generateDeployedNode(
156156
getLogger().info('Details are missing or are incomplete for: %O', deployedResource)
157157
return [
158158
createPlaceholderItem(
159-
localize('AWS.appBuilder.explorerNode.noApps', '[This resource is not yet supported in AppBuilder.]')
159+
localize(
160+
'AWS.appBuilder.explorerNode.noApps',
161+
'[This resource is not yet supported in AppBuilder.]'
162+
)
160163
),
161164
]
162165
}
@@ -166,7 +169,7 @@ export async function generateDeployedNode(
166169
createPlaceholderItem(
167170
localize(
168171
'AWS.appBuilder.explorerNode.unavailableDeployedResource',
169-
'[Failed to retrieve deployed resource. Please ensure stack name, region, and account credentials are correct.]'
172+
'[Failed to retrieve deployed resource. Ensure correct stack name and region are in the samconfig.toml, and that your account is connected.]'
170173
)
171174
),
172175
]

packages/core/src/awsService/appBuilder/explorer/samProject.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export async function getStackName(projectRoot: vscode.Uri): Promise<any> {
4545
getLogger().info('Stack name and/or region information not found in samconfig.toml: %O', error)
4646
break
4747
case SamConfigErrorCode.samConfigParseError:
48-
getLogger().error(`Error parsing stack name and/or region information from samconfig.toml: ${error.message}. Please ensure the information is correct.`, error)
48+
getLogger().error(
49+
`Error parsing stack name and/or region information from samconfig.toml: ${error.message}. Ensure the information is correct.`,
50+
error
51+
)
4952
void showViewLogsMessage('Encountered an issue reading samconfig.toml')
5053
break
5154
default:

packages/core/src/awsService/appBuilder/utils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ export async function runOpenHandler(arg: ResourceNode): Promise<void> {
5656
arg.resource.resource.Runtime
5757
)
5858
if (!handlerFile) {
59-
throw new ToolkitError(`No handler file found with name "${arg.resource.resource.Handler}". Please ensure the file exists in the expected location."`, {
60-
code: 'NoHandlerFound',
61-
})
59+
throw new ToolkitError(
60+
`No handler file found with name "${arg.resource.resource.Handler}". Ensure the file exists in the expected location."`,
61+
{
62+
code: 'NoHandlerFound',
63+
}
64+
)
6265
}
6366
await vscode.workspace.openTextDocument(handlerFile).then(async (doc) => await vscode.window.showTextDocument(doc))
6467
}

packages/core/src/awsService/appBuilder/walkthrough.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export async function getTutorial(
148148
const appSelected = appMap.get(project + runtime)
149149
telemetry.record({ action: project + runtime, source: source ?? 'AppBuilderWalkthrough' })
150150
if (!appSelected) {
151-
throw new ToolkitError(`Template '${project}+${runtime}' does not exist, please choose another template.`)
151+
throw new ToolkitError(`Template '${project}+${runtime}' does not exist, choose another template.`)
152152
}
153153

154154
try {
@@ -258,7 +258,7 @@ export async function initWalkthroughProjectCommand() {
258258
if (!walkthroughSelected || !(typeof walkthroughSelected === 'string')) {
259259
getLogger().info('No walkthrough selected - exiting')
260260
void vscode.window.showErrorMessage(
261-
localize('AWS.toolkit.lambda.walkthroughNotSelected', 'Please select a template in the walkthrough.')
261+
localize('AWS.toolkit.lambda.walkthroughNotSelected', 'Select a template in the walkthrough.')
262262
)
263263
return
264264
}

packages/core/src/test/awsService/appBuilder/explorer/samProject.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ describe('samProject', () => {
7171

7272
const result = await wrapperCall(undefined)
7373
assert.deepStrictEqual(result, {})
74-
assertLogsContain('Error parsing stack name and/or region information: No project folder found', false, 'warn')
74+
assertLogsContain(
75+
'Error parsing stack name and/or region information: No project folder found',
76+
false,
77+
'warn'
78+
)
7579
})
7680

7781
it('returns empty object given no samconfig file found', async () => {

packages/core/src/test/shared/applicationBuilder/explorer/nodes/appNode.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ describe('AppNode', () => {
157157
assert.strictEqual(resourceNode.id, 'placeholder')
158158
assert.strictEqual(
159159
resourceNode.resource,
160-
'[Unable to load Resource tree for this App. Update SAM template]'
160+
'[Unable to load resource tree for this app. Ensure SAM template is correct.]'
161161
)
162162
assert(getAppStub.calledOnce)
163163
assert(getStackNameStub.notCalled)

packages/core/src/test/shared/applicationBuilder/explorer/nodes/deployedNode.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ describe('generateDeployedNode', () => {
220220
// Check placeholder propertries
221221
const deployedResourceNode = deployedResourceNodes[0] as DeployedResourceNode
222222
assert.strictEqual(deployedResourceNode.id, 'placeholder')
223-
assert.strictEqual(deployedResourceNode.resource, '[Failed to retrive deployed resource.]')
223+
assert.strictEqual(
224+
deployedResourceNode.resource,
225+
'[Failed to retrieve deployed resource. Ensure correct stack name and region are in the samconfig.toml, and that your account is connected.]'
226+
)
224227
})
225228
})
226229

@@ -374,7 +377,7 @@ describe('generateDeployedNode', () => {
374377
// Check placeholder propertries
375378
const deployedResourceNode = deployedResourceNodes[0] as DeployedResourceNode
376379
assert.strictEqual(deployedResourceNode.id, 'placeholder')
377-
assert.strictEqual(deployedResourceNode.resource, '[This resource is not yet supported.]')
380+
assert.strictEqual(deployedResourceNode.resource, '[This resource is not yet supported in AppBuilder.]')
378381
})
379382
})
380383
})
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "AppBuilder: Update error messaging to make more legible and actionable"
4+
}

0 commit comments

Comments
 (0)