Skip to content

Conversation

@shafeeqd959
Copy link
Contributor

No description provided.

@shafeeqd959 shafeeqd959 changed the base branch from development to feat/import-setup-command-base September 3, 2024 11:17
@shafeeqd959 shafeeqd959 marked this pull request as ready for review September 3, 2024 11:21
@shafeeqd959 shafeeqd959 requested a review from a team as a code owner September 3, 2024 11:21
@@ -0,0 +1 @@
{} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shafeeqd959 what purpose we used this empty object file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add messages in future commits

"dependencies": {
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.1",
"@contentstack/management": "~1.17.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shafeeqd959 , Since we're using cli-utilities, so management sdk isn't required here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove in the upcoming commits

Comment on lines +1 to +21
export const formatError = (error: any) => {
try {
if (typeof error === 'string') {
error = JSON.parse(error);
} else {
error = JSON.parse(error.message);
}
} catch (e) {}
let message = error?.errorMessage || error?.error_message || error?.message || error;
if (error && error.errors && Object.keys(error.errors).length > 0) {
Object.keys(error.errors).forEach((e) => {
let entity = e;
if (e === 'authorization') entity = 'Management Token';
if (e === 'api_key') entity = 'Stack API key';
if (e === 'uid') entity = 'Content Type';
if (e === 'access_token') entity = 'Delivery Token';
message += ' ' + [entity, error.errors[e]].join(' ');
});
}
return message;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shafeeqd959 , We can utilise formatError, which we created in utilities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will use it in the upcoming commits

@shafeeqd959 shafeeqd959 merged commit 97c3546 into feat/import-setup-command-base Sep 4, 2024
cs-raj pushed a commit that referenced this pull request Oct 8, 2024
shafeeqd959 added a commit that referenced this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants