Skip to content

Commit 525e2f6

Browse files
author
markzegarelli
authored
Don't nuke the whole file if 404 (#3949)
1 parent ba497b7 commit 525e2f6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scripts/private-destination.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ const PRIVATE_DESTINATIONS = yaml.load(fs.readFileSync(path.resolve(__dirname, `
2020
const privateDests = PRIVATE_DESTINATIONS.items
2121
let private = []
2222
const getCatalog = async (url, page_token = "MA==") => {
23+
let res = null
2324
try {
24-
const res = await axios.get(url, {
25+
res = await axios.get(url, {
2526
headers: {
2627
'Content-Type': 'application/json',
2728
'Authorization': `Bearer ${process.env.PAPI_TOKEN}`
@@ -33,10 +34,14 @@ const getCatalog = async (url, page_token = "MA==") => {
3334
}
3435
}
3536
});
36-
3737
return res.data
38-
} catch (error) {
39-
console.log(error)
38+
} catch (err) {
39+
console.error("Error response:");
40+
console.error(err.response.data); // ***
41+
console.error(err.response.status); // ***
42+
console.error(err.response.headers); // ***
43+
} finally {
44+
4045
}
4146
}
4247

@@ -48,6 +53,9 @@ const checkDestinationStatus = async (id) => {
4853
}
4954
const getDestinationData = async (id) => {
5055
const res = await getCatalog(`${PAPI_URL}/catalog/destinations/${id}`)
56+
if (res == null) {
57+
return
58+
}
5159
let destination = res.data.destinationMetadata
5260
let settings = destination.options
5361
settings.sort((a, b) => {

0 commit comments

Comments
 (0)