Skip to content

Commit

Permalink
feat: Add HTTP_NOT_FOUND constant and use it in dts-process.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nikiwycherley committed May 8, 2024
1 parent 85fc569 commit 8f36696
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/functions/imtd-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const pg = require('../helpers/db')
const invokeLambda = require('../helpers/invoke-lambda')
const deleteThresholds = require('../helpers/imtd-api').deleteStation
const tableName = 'station_imtd_threshold'
const { HTTP_NOT_FOUND } = require('../constants')

async function insertThresholds (stationId, thresholds) {
try {
Expand Down Expand Up @@ -34,7 +35,7 @@ async function getImtdApiResponse (stationId) {
try {
return await axios.get(`https://${hostname}/Location/${stationId}?version=2`)
} catch (error) {
if (error.response?.status === 404) {
if (error.response?.status === HTTP_NOT_FOUND) {
logger.info(`Station ${stationId} not found (HTTP Status: 404)`)
} else {
const message = error.response?.status ? `HTTP Status: ${error.response.status}` : `Error: ${error.message}`
Expand Down
2 changes: 1 addition & 1 deletion lib/models/rloi.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function removePostfix (name) {
}

async function fetchStation (s3, bucket, key) {
return await s3.getObject({
return s3.getObject({
Bucket: bucket,
Key: key
})
Expand Down

0 comments on commit 8f36696

Please sign in to comment.