Skip to content

Commit

Permalink
[Nu-7476] Add more info about failed deployment due to cron miss-conf…
Browse files Browse the repository at this point in the history
…iguration
  • Loading branch information
Piotr Rudnicki committed Jan 20, 2025
1 parent 0a840b4 commit b3b650c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion designer/client/src/devHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export function withLogs<A extends unknown[], R>(fn: (...args: A) => R, message?

export function handleAxiosError(error: AxiosError): string {
if (error.response?.data && typeof error.response.data === "string") {
return error.response.data;
if (error.response.data.startsWith("No future date determined by CronScheduleProperty")) {
return i18next.t("errors.axiosError.scheduledCron", "problem with scheduled date");
} else {
return error.response.data;
}
}

const httpStatusCode = error.response?.status;
Expand Down
7 changes: 5 additions & 2 deletions designer/client/src/http/HttpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,13 @@ class HttpService {
.then(() => {
return { isSuccess: true };
})
.catch((error) => {
.catch((error: AxiosError) => {
if (error?.response?.status != 400) {
return this.#addError(
i18next.t("notification.error.failedToDeploy", "Failed to deploy {{processName}}", { processName }),
i18next.t("notification.error.failedToDeploy", "Failed to deploy {{processName}} due to: {{axiosError}}", {
processName,
axiosError: handleAxiosError(error),
}),
error,
true,
).then(() => {
Expand Down

0 comments on commit b3b650c

Please sign in to comment.