File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -43,19 +43,23 @@ class BaseClient {
43
43
// Using Reduce to compute the validity of all extractors
44
44
const allExtractorsValid = await this . extractors . reduce ( async ( curExtractorsValid , curExtractor ) => {
45
45
const { name } = curExtractor . constructor ;
46
-
47
46
if ( curExtractor . validate ) {
48
47
logger . debug ( `Validating ${ name } ` ) ;
49
- const isExtractorValid = await curExtractor . validate ( ) ;
50
- if ( isExtractorValid ) {
51
- logger . debug ( `Extractor ${ name } PASSED CSV validation` ) ;
52
- } else {
48
+ try {
49
+ const isExtractorValid = await curExtractor . validate ( ) ;
50
+ if ( isExtractorValid ) {
51
+ logger . debug ( `Extractor ${ name } PASSED CSV validation` ) ;
52
+ } else {
53
+ logger . warn ( `Extractor ${ name } FAILED CSV validation` ) ;
54
+ }
55
+ return ( ( await curExtractorsValid ) && isExtractorValid ) ;
56
+ } catch ( e ) {
53
57
logger . warn ( `Extractor ${ name } FAILED CSV validation` ) ;
58
+ return false ;
54
59
}
55
- return ( curExtractorsValid && isExtractorValid ) ;
56
60
}
57
61
return curExtractorsValid ;
58
- } , true ) ;
62
+ } , Promise . resolve ( true ) ) ;
59
63
60
64
if ( allExtractorsValid ) {
61
65
logger . info ( 'Validation succeeded' ) ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class CSVURLModule {
20
20
const csvData = await axios . get ( this . url )
21
21
. then ( ( res ) => res . data )
22
22
. catch ( ( e ) => {
23
- logger . error ( 'Error occurred when getting CSV data using url' ) ;
23
+ logger . error ( 'Error occurred when making a connection to this url' ) ;
24
24
throw e ;
25
25
} ) ;
26
26
logger . debug ( 'Web request successful' ) ;
@@ -29,7 +29,7 @@ class CSVURLModule {
29
29
columns : ( header ) => header . map ( ( column ) => stringNormalizer ( column ) ) ,
30
30
bom : true ,
31
31
} ) ;
32
- logger . debug ( 'Data parsing successful' ) ;
32
+ logger . debug ( 'CSV Data parsing successful' ) ;
33
33
this . data = normalizeEmptyValues ( parsedData , this . unalterableColumns ) ;
34
34
}
35
35
}
You can’t perform that action at this time.
0 commit comments