File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ export class LicenseEvidenceFetcher {
6868 }
6969
7070 * fetchAsAttachment ( prefixPath : string , onError : ErrorReporter = noop ) : Generator < FetchedAttachmentResult > {
71- const files = this . #fs. readdirSync ( prefixPath )
71+ const files = this . #fs. readdirSync ( prefixPath ) // may throw
7272 for ( const file of files ) {
7373 if ( ! LICENSE_FILENAME_PATTERN . test ( file ) ) {
7474 continue
@@ -85,17 +85,11 @@ export class LicenseEvidenceFetcher {
8585 }
8686 try {
8787 yield { filePath, file, text : new Attachment (
88- this . #fs. readFileSync ( filePath ) . toString ( 'base64' ) ,
89- {
90- contentType,
91- encoding : AttachmentEncoding . Base64
92- }
93- )
94- }
95- }
96- /* c8 ignore next 3 */
97- catch ( e ) {
98- onError ( new Error ( `skipped license file ${ filePath } ` , { cause : e } ) )
88+ this . #fs. readFileSync ( filePath ) . toString ( 'base64' ) , // may throw
89+ { contentType, encoding : AttachmentEncoding . Base64 }
90+ ) }
91+ } catch ( cause ) {
92+ onError ( new Error ( `skipped license file ${ filePath } ` , { cause} ) )
9993 }
10094 }
10195 }
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ const assert = require('node:assert')
2121
2222const { suite, test } = require ( 'mocha' )
2323
24-
2524const {
2625 getMimeForLicenseFile
2726} = require ( '../../dist.node/_helpers/mime.js' )
You can’t perform that action at this time.
0 commit comments