Skip to content

Commit

Permalink
fix: better generic error for deploy + more error handling (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
parishahla authored Jul 20, 2024
1 parent 358fe2d commit 44d1a21
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/commands/app/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class AppLogs extends Command {
await this.sleep(1000);
if (start) {
start += 1;
this.debug && this.debug('since timpestamp', start);
this.debug(`start timestamp: ${start}`);
}
}
}
Expand Down Expand Up @@ -158,7 +158,7 @@ export default class AppLogs extends Command {
}

if (error.response && error.response.statusCode === 428) {
console.log(error.response.body);
this.debug(error.response.body);
const message = `To view more logs, upgrade your feature bundle plan, first.
Then try again.
https://console.liara.ir/apps/${appName}/resize`;
Expand All @@ -167,13 +167,15 @@ export default class AppLogs extends Command {
process.exit(2);
}

this.debug(error);

console.error(
new Errors.CLIError(
' Invalid time format for --since. Please check the format and try again. Enable --debug for more details.',
).render(),
);
this.debug(error.response.body ? error.response.body : error.response);
const genericErrorMessage: string = `'We encountered an issue and were unable to retrieve the logs.
Solutions:
1) Check console logs from https://console.liara.ir/apps/${appName}/logs
2) Try ' liara logs -f --since="1 minute ago" ' command to see app logs.
3) Enable --debug for more details.
4) Try again later.
`;
console.error(new Errors.CLIError(genericErrorMessage).render());
process.exit(2);
}
};
Expand Down

0 comments on commit 44d1a21

Please sign in to comment.