Skip to content

Commit

Permalink
🇺🇦 #StandWithUkraine Improve Job Console Output
Browse files Browse the repository at this point in the history
  • Loading branch information
raycharius committed Mar 25, 2022
1 parent 9de476e commit 55873c8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jobs/handle-job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const token = process.env.JOBS_API_TOKEN!;

export default function handleJob(name: string): void {
axios.get(`${host}/api/jobs/${name}?token=${token}`)
.then(() => console.log(`The job \`${name}\` has been successfully initiated. Please see the server's logs for additional output upon completion.`))
.catch((error) => {
const hasErrorTextInResponse = axios.isAxiosError(error)
&& error.response
Expand All @@ -16,6 +17,8 @@ export default function handleJob(name: string): void {

if (hasErrorTextInResponse) {
console.log((error as AxiosError).response!.data!.message!);

return;
}

const hasOtherErrorText = error instanceof Error && error.message;
Expand Down

0 comments on commit 55873c8

Please sign in to comment.