File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ function normalizeFilePath(path) {
88}
99
1010function checkForExtension ( filename , ext = "pdf" ) {
11- return filename . includes ( `.${ ext } ` )
11+ return filename . endsWith ( `.${ ext } ` )
1212 ? filename
1313 : `${ filename } .${ ext } ` ;
1414}
@@ -26,16 +26,19 @@ function downloadToTmp(response, filename) {
2626}
2727
2828function handleErrorMessage ( error ) {
29+ if ( ! error ) {
30+ throw new ConfigurationError ( "Unknown error occurred" ) ;
31+ }
2932 let errorMessage = error . name ;
30- if ( error . response && error . response . data ) {
33+ if ( error . response ? .data ) {
3134 const text = Buffer . from ( error . response . data ) . toString ( "utf-8" ) ;
3235 try {
3336 errorMessage = JSON . stringify ( JSON . parse ( text ) ) ;
3437 } catch ( parseErr ) {
3538 errorMessage = text ;
3639 }
3740 }
38- throw new ConfigurationError ( ` ${ errorMessage } ` ) ;
41+ throw new ConfigurationError ( errorMessage ) ;
3942}
4043
4144export default {
You can’t perform that action at this time.
0 commit comments