This repository was archived by the owner on Feb 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +1036
-1926
lines changed
Expand file tree Collapse file tree 5 files changed +1036
-1926
lines changed Original file line number Diff line number Diff line change 2929 },
3030 "dependencies" : {},
3131 "devDependencies" : {
32- "@tsconfig/node10" : " ^1.0.7 " ,
33- "@types/jest" : " ^26 .0.13 " ,
34- "@types/node" : " ^14.6.4 " ,
35- "@typescript-eslint/eslint-plugin" : " ^4.0 .1" ,
36- "@typescript-eslint/parser" : " ^4.0 .1" ,
37- "eslint" : " ^7.8.1 " ,
38- "jest" : " ^26.4.2 " ,
39- "ts-jest" : " ^26.3.0 " ,
40- "typescript" : " ^4.0.2 "
32+ "@tsconfig/node10" : " ^1.0.8 " ,
33+ "@types/jest" : " ^27 .0.1 " ,
34+ "@types/node" : " ^16.9.2 " ,
35+ "@typescript-eslint/eslint-plugin" : " ^4.31 .1" ,
36+ "@typescript-eslint/parser" : " ^4.31 .1" ,
37+ "eslint" : " ^7.32.0 " ,
38+ "jest" : " ^27.2.0 " ,
39+ "ts-jest" : " ^27.0.5 " ,
40+ "typescript" : " ^4.4.3 "
4141 },
4242 "keywords" : [
4343 " c" ,
Original file line number Diff line number Diff line change @@ -182,7 +182,8 @@ export default class Cli {
182182 try {
183183 fs . writeFileSync ( outputFilePath , content )
184184 } catch ( error ) {
185- throw new CliError ( `Error writing output to file '${ outputFilePath } ': ${ error . message } ` , ErrorCode . WriteError ) ;
185+ const causeMessage = error instanceof Error ? error . message : 'Unknown error' ;
186+ throw new CliError ( `Error writing output to file '${ outputFilePath } ': ${ causeMessage } ` , ErrorCode . WriteError ) ;
186187 }
187188 }
188189}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export class TraceError extends Error {
1313 }
1414}
1515
16- export function formatErrorStack ( error : Error | string ) : string {
16+ export function formatErrorStack ( error : Error | string | unknown ) : string {
1717 if ( error instanceof TraceError && error . cause ) {
1818 return [
1919 error . stack || error . message ,
@@ -26,5 +26,5 @@ export function formatErrorStack(error: Error | string): string {
2626 return error . stack || error . message ;
2727 }
2828
29- return error || '' ;
29+ return ` ${ error } ` ;
3030}
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export function readFile(filePath: string): string {
2121 try {
2222 return fs . readFileSync ( filePath , "utf-8" ) ;
2323 } catch ( error ) {
24- throw new FileReadError ( `Error reading file '${ filePath } '` , filePath , error ) ;
24+ const cause = error instanceof Error ? error : undefined ;
25+ throw new FileReadError ( `Error reading file '${ filePath } '` , filePath , cause ) ;
2526 }
2627}
You can’t perform that action at this time.
0 commit comments