Skip to content

Commit

Permalink
fix: update confusing error codes aws-amplify#6617
Browse files Browse the repository at this point in the history
  • Loading branch information
gitaalekhyapaul committed Apr 7, 2021
1 parent 3477154 commit cba35db
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/amplify-cli-core/src/state-manager/pathManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ export class PathManager {

private createNotInitializedError = (): Error => {
const error = new Error(
"You are not working inside a valid Amplify project.\nUse 'amplify init' in the root of your app directory to initialize your project, or 'amplify pull' to pull down an existing project.",
`
No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Admin UI.
`,
);

error.name = 'NotInitialized';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { stateManager } from 'amplify-cli-core';
export function getProjectMeta() {
if (!stateManager.metaFileExists()) {
const error = new Error(
"You are not working inside a valid Amplify project.\nUse 'amplify init' in the root of your app directory to initialize your project, or 'amplify pull' to pull down an existing project.",
`
No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Admin UI.
`,
);

error.name = 'NotInitialized';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ export function getCurrentAmplifyMetaFilePath(projectPath?) {

function createNotInitializedError() {
const error = new Error(
"You are not working inside a valid Amplify project.\nUse 'amplify init' in the root of your app directory to initialize your project, or 'amplify pull' to pull down an existing project.",
`
No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Admin UI.
`,
);

error.name = 'NotInitialized';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ export async function getResourceStatus(category?, resourceName?, providerName?,
amplifyMeta = stateManager.getBackendConfig();
} else {
const error = new Error(
"You are not working inside a valid Amplify project.\nUse 'amplify init' in the root of your app directory to initialize your project, or 'amplify pull' to pull down an existing project.",
`
No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Admin UI.
`,
);

error.name = 'NotInitialized';
Expand Down

0 comments on commit cba35db

Please sign in to comment.