Skip to content

Commit

Permalink
logging errors when url get fails, or parsing errors occur
Browse files Browse the repository at this point in the history
  • Loading branch information
mwise-va committed Jul 12, 2024
1 parent a4118bf commit 75fcea2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/idpMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export function fetch(url, idpMetadataFallback) {

parser.parseString(responseData, (err, docEl) => {
if (err || !docEl) {
// Error parsing response data, fallback to idpMetadataFallback
console.error(
"Error parsing response data, fallback to idpMetadataFallback"
);
parseXML(idpMetadataFallback)
.then((xmlData) => processMetadata(xmlData, metadata))
.then(resolve)
Expand All @@ -108,7 +110,9 @@ export function fetch(url, idpMetadataFallback) {
});
})
.catch(() => {
// Error fetching metadata from URL, fallback to idpMetadataFallback
console.error(
"Error fetching metadata from URL, fallback to idpMetadataFallback"
);
parseXML(idpMetadataFallback)
.then((xmlData) => processMetadata(xmlData, metadata))
.then(resolve)
Expand Down

0 comments on commit 75fcea2

Please sign in to comment.