Skip to content

Commit

Permalink
chore: Improve Unifrom error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Oct 18, 2023
1 parent d86cd87 commit fe6b373
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api.planx.uk/send/uniform.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosRequestConfig } from "axios";
import axios, { AxiosRequestConfig, isAxiosError } from "axios";
import { NextFunction, Request, Response } from "express";
import { Buffer } from "node:buffer";
import FormData from "form-data";
Expand Down Expand Up @@ -157,9 +157,11 @@ export async function sendToUniform(
application: applicationAuditRecord,
});
} catch (error) {
let loggedError = error;
if (isAxiosError(error)) loggedError = error.toJSON();
return next({
error,
message: `Failed to send to Uniform (${localAuthority}): ${error}`,
message: `Failed to send to Uniform (${localAuthority}): ${loggedError}`,
});
}
}
Expand Down

0 comments on commit fe6b373

Please sign in to comment.