@@ -95,43 +95,47 @@ module td.converter
9595 } catch ( error ) {
9696 var msg = [ ] ;
9797 msg . push ( 'An error occurred while creating reflections for the current project.' ) ;
98- msg . push ( ' | Please report this error at https://github.com/sebastian-lenz/typedoc/issues' ) ;
99- msg . push ( ' | including the following details:' ) ;
100- msg . push ( ' |' ) ;
98+ msg . push ( 'Please report this error at https://github.com/sebastian-lenz/typedoc/issues' ) ;
99+ msg . push ( 'including the following details:' ) ;
100+ msg . push ( '' ) ;
101+ msg . push ( '>>> BEGIN OF ERROR DESCRIPTION' ) ;
102+ msg . push ( '' ) ;
101103
102104 try {
103105 var sourceFile = ts . getSourceFileOfNode ( node ) ;
104106 var line = sourceFile . getLineAndCharacterFromPosition ( node . pos ) ;
105107
106108 if ( node . symbol ) {
107109 msg . push ( Util . format (
108- ' | The error occurred while converting `%s` in `%s` around line %s:' ,
110+ 'The error occurred while converting `%s` in `%s` around line %s:' ,
109111 context . checker . getFullyQualifiedName ( node . symbol ) ,
110112 ts . getBaseFilename ( sourceFile . filename ) , line . line ) ) ;
111113 } else {
112114 msg . push ( Util . format (
113- ' | The error occurred while converting `%s` around line %s:' ,
115+ 'The error occurred while converting `%s` around line %s:' ,
114116 ts . getBaseFilename ( sourceFile . filename ) , line . line ) ) ;
115117 }
116118
117- var lines = sourceFile . getLineStarts ( ) ;
119+ var lineData , lines = sourceFile . getLineStarts ( ) ;
120+ var lineCount = lines . length - 1 ;
118121 var min = Math . max ( line . line - 2 , 0 ) ;
119- var max = Math . min ( line . line + 25 , lines . length - 2 ) ;
122+ var max = Math . min ( line . line + 25 , lineCount ) ;
120123
124+ msg . push ( '' , '```' ) ;
121125 for ( var index = min ; index <= max ; index ++ ) {
122- msg . push (
123- ( index == line . line - 1 ? ' | @ ' : ' | > ' ) +
124- sourceFile . text . substring ( lines [ index ] , lines [ index + 1 ] - 1 )
125- ) ;
126- }
127- msg . push ( ' |' ) ;
128- } catch ( error ) { }
126+ if ( index == lineCount ) {
127+ lineData = sourceFile . text . substring ( lines [ index ] ) ;
128+ } else {
129+ lineData = sourceFile . text . substring ( lines [ index ] , lines [ index + 1 ] - 1 ) ;
130+ }
129131
130- error . stack . split ( '\n' ) . forEach ( ( str , index ) => {
131- msg . push ( ( index == 0 ? ' | ' : ' | ' ) + str . trim ( ) ) ;
132- } ) ;
132+ msg . push ( ( index == line . line - 1 ? '@ ' : ' ' ) + lineData ) ;
133+ }
134+ msg . push ( '```' ) ;
135+ } catch ( sourceError ) { }
133136
134- msg . push ( '' ) ;
137+ msg . push ( '' , '```' , error . stack , '```' ) ;
138+ msg . push ( '' , '<<< END OF ERROR DESCRIPTION' , '' , '' ) ;
135139 context . getLogger ( ) . error ( msg . join ( '\n' ) ) ;
136140 }
137141 }
0 commit comments