Skip to content

Commit 87143b2

Browse files
committed
fix(LLMO-4070): log warning when Configuration.findLatest fails
Bare catch {} swallowed all errors silently. Log the error at warn level so S3 unavailability is visible in logs while still allowing the request to proceed without the audit-type registration check.
1 parent d156595 commit 87143b2

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/controllers/audits.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ function AuditsController(ctx) {
221221
let configuration;
222222
try {
223223
configuration = await Configuration.findLatest();
224-
} catch {
225-
// Configuration unavailable — skip audit-type registration check
224+
} catch (err) {
225+
context.log.warn(`Failed to load configuration, skipping audit-type check: ${err.message}`);
226226
}
227227
if (configuration) {
228228
const registeredAudits = configuration.getHandlers();

test/controllers/audits.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,10 +859,12 @@ describe('Audits Controller', () => {
859859
it('proceeds without audit-type check when Configuration.findLatest throws', async () => {
860860
mockDataAccess.Configuration.findLatest.rejects(new Error('S3 bucket not found'));
861861
const auditType = 'broken-backlinks';
862+
const log = { warn: sinon.stub() };
862863

863864
const context = {
864865
params: { siteId, auditType },
865866
data: {},
867+
log,
866868
};
867869

868870
const result = await auditsController.patchAuditForSite(context);
@@ -871,6 +873,8 @@ describe('Audits Controller', () => {
871873
expect(result.status).to.equal(400);
872874
const error = await result.json();
873875
expect(error).to.have.property('message', 'No updates provided');
876+
expect(log.warn).to.have.been.calledOnce;
877+
expect(log.warn.firstCall.args[0]).to.include('S3 bucket not found');
874878
});
875879

876880
it('merges manual overwrites correctly', async () => {

0 commit comments

Comments
 (0)