Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions src/lib/constants/Messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export const Messages = {

APP_NOT_INSTALLED:
"The app you're trying to submit must be installed on this workspace.",

VALIDATION_FAILED_UNKNOWN_REASON:
'Your submission could not be validated. Make sure your app is both published and deployed before running `vtex submit`, then try again. If the problem persists, contact VTEX support.',

ENTER_GITHUB_USERNAME: 'Enter your Github username',
ENTER_STATUS_CHECK_URL:
'Enter a URL from where we can test your app working. It can be in your workspace',
Expand Down
15 changes: 14 additions & 1 deletion src/modules/submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,26 @@
const VTEX_VENDOR = 'vtex'
const APP_STORE_ACCOUNT = 'extensions'

const handleSubmitAppError = (e: any) => {

Check warning on line 11 in src/modules/submit.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
const response = e?.response
const status = response?.status

switch (status) {
case 400: {
logger.error(Messages.OBJECT_FORMAT, JSON.parse(response?.data?.message))
try {
logger.error(
Messages.OBJECT_FORMAT,
JSON.parse(response?.data?.message)
)
} catch {
// response.data.message isn't valid JSON (e.g. an upstream service propagated
// a raw error string instead of a structured validation payload). Surface a
// clear, actionable message instead of letting the SyntaxError bubble up raw.
logger.error(
response?.data?.message ?? Messages.VALIDATION_FAILED_UNKNOWN_REASON
)
}

break
}

Expand Down
Loading