Skip to content

Commit

Permalink
added slightly better error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgtho committed Sep 22, 2023
1 parent b47b041 commit 420e1e8
Show file tree
Hide file tree
Showing 2 changed files with 1,867 additions and 917 deletions.
19 changes: 12 additions & 7 deletions lib/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const verifyExt = (ext) => {
return valid
}

const getError = (error) => {
const errormsg = error.response?.data || error.stack || error.toString()
return errormsg
}

const getExtFromInfo = (infoStr) => {
const unknownFileExt = 'UF'
if (typeof infoStr !== 'string') {
Expand Down Expand Up @@ -112,7 +117,7 @@ module.exports.archive = async (blobContent, archiveOptions) => {
blobContent.flow.archive.status = 'finished'
}
} catch (error) {
blobContent.flow.archive = { error }
blobContent.flow.archive = { error: getError(error) }
blobContent.flow.archive.status = 'failed'
}

Expand All @@ -137,7 +142,7 @@ module.exports.signOff = async blobContent => {
blobContent.flow.signOff.status = 'finished'
}
} catch (error) {
blobContent.flow.signOff = { error }
blobContent.flow.signOff = { error: getError(error) }
blobContent.flow.signOff.status = 'failed'
}

Expand All @@ -163,7 +168,7 @@ module.exports.syncElevmappa = async blobContent => {
return blobContent
}
} catch (error) {
blobContent.flow.syncElevmappa = { error }
blobContent.flow.syncElevmappa = { error: getError(error) }
blobContent.flow.syncElevmappa.status = 'failed'
return blobContent
}
Expand All @@ -189,7 +194,7 @@ module.exports.syncElevmappa = async blobContent => {
return blobContent
}
} catch (error) {
blobContent.flow.syncElevmappa = { error }
blobContent.flow.syncElevmappa = { error: getError(error) }
blobContent.flow.syncElevmappa.status = 'failed'
return blobContent
}
Expand Down Expand Up @@ -259,7 +264,7 @@ module.exports.archiveResponseLetter = async (blobContent) => {
blobContent.flow.archiveResponseLetter.status = 'finished'
}
} catch (error) {
blobContent.flow.archiveResponseLetter = { error }
blobContent.flow.archiveResponseLetter = { error: getError(error) }
blobContent.flow.archiveResponseLetter.status = 'failed'
}

Expand Down Expand Up @@ -297,7 +302,7 @@ module.exports.sendResponseLetter = async (blobContent) => {
}
}
} catch (error) {
blobContent.flow.sendResponseLetter = { error }
blobContent.flow.sendResponseLetter = { error: getError(error) }
blobContent.flow.sendResponseLetter.status = 'failed'
}

Expand Down Expand Up @@ -333,7 +338,7 @@ module.exports.signOffResponseLetter = async (blobContent) => {
}
}
} catch (error) {
blobContent.flow.signOffResponseLetter = { error }
blobContent.flow.signOffResponseLetter = { error: getError(error) }
blobContent.flow.signOffResponseLetter.status = 'failed'
}

Expand Down
Loading

0 comments on commit 420e1e8

Please sign in to comment.