Skip to content

Commit

Permalink
modified logging of 404s for pvc, configmaps and secrets (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlassak authored Oct 5, 2022
1 parent 63747b6 commit 5e9f2bc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion backend/src/routes/api/configmaps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ module.exports = async (fastify: KubeFastifyInstance) => {
e.message || res.message,
e.code,
);
fastify.log.error(`Configmap ${cmName} could not be read, ${error}`);
if (res.statusCode !== 404) {
fastify.log.error(`Configmap ${cmName} could not be read, ${error}`);
}
throw error;
});
},
Expand Down
8 changes: 5 additions & 3 deletions backend/src/routes/api/pvc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ module.exports = async (fastify: KubeFastifyInstance) => {
);
return pvcResponse.body;
} catch (e) {
fastify.log.error(
`PVC ${pvcName} could not be read, ${e.response?.body?.message || e.message || e}`,
);
if (e.statusCode !== 404) {
fastify.log.error(
`PVC ${pvcName} could not be read, ${e.response?.body?.message || e.message || e}`,
);
}
reply.send(e);
}
},
Expand Down
12 changes: 7 additions & 5 deletions backend/src/routes/api/secrets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ module.exports = async (fastify: KubeFastifyInstance) => {
);
return secretResponse.body;
} catch (e) {
fastify.log.error(
`Secret ${secretName} could not be read, ${
e.response?.body?.message || e.message || e
}`,
);
if (e.statusCode !== 404) {
fastify.log.error(
`Secret ${secretName} could not be read, ${
e.response?.body?.message || e.message || e
}`,
);
}
reply.send(e);
}
},
Expand Down

0 comments on commit 5e9f2bc

Please sign in to comment.