File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ var sys: System = (function () {
68
68
return fileStream . ReadText ( ) ;
69
69
}
70
70
catch ( e ) {
71
- throw e . number === - 2147024809 ? new Error ( ts . Diagnostics . Unsupported_file_encoding . key ) : e ;
71
+ throw e ;
72
72
}
73
73
finally {
74
74
fileStream . Close ( ) ;
Original file line number Diff line number Diff line change @@ -142,14 +142,19 @@ module ts {
142
142
// otherwise use toLowerCase as a canonical form.
143
143
return sys . useCaseSensitiveFileNames ? fileName : fileName . toLowerCase ( ) ;
144
144
}
145
-
145
+
146
+ // returned by CScript sys environment
147
+ var unsupportedFileEncodingErrorCode = - 2147024809 ;
148
+
146
149
function getSourceFile ( filename : string , languageVersion : ScriptTarget , onError ?: ( message : string ) => void ) : SourceFile {
147
150
try {
148
151
var text = sys . readFile ( filename , options . charset ) ;
149
152
}
150
153
catch ( e ) {
151
154
if ( onError ) {
152
- onError ( e . message ) ;
155
+ onError ( e . number === unsupportedFileEncodingErrorCode ?
156
+ getDiagnosticText ( Diagnostics . Unsupported_file_encoding ) :
157
+ e . message ) ;
153
158
}
154
159
text = "" ;
155
160
}
You can’t perform that action at this time.
0 commit comments