File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 11import * as vscode from "vscode" ;
22import { AtelierAPI } from "../api" ;
3+ import { outputChannel } from "../utils" ;
34
45export class XmlContentProvider implements vscode . TextDocumentContentProvider {
56 private _api : AtelierAPI ;
@@ -10,12 +11,23 @@ export class XmlContentProvider implements vscode.TextDocumentContentProvider {
1011 }
1112
1213 public provideTextDocumentContent ( uri : vscode . Uri , token : vscode . CancellationToken ) : vscode . ProviderResult < string > {
13- // uri.query.
1414 return vscode . workspace
1515 . openTextDocument ( vscode . Uri . file ( uri . fragment ) )
1616 . then ( ( document ) => document . getText ( ) )
17- . then ( ( text ) => this . _api . cvtXmlUdl ( text ) )
18- . then ( ( data ) => data . result . content [ 0 ] . content . join ( "\n" ) ) ;
17+ . then ( ( text ) => {
18+ return this . _api
19+ . cvtXmlUdl ( text )
20+ . then ( ( data ) => data . result . content [ 0 ] . content . join ( "\n" ) )
21+ . catch ( ( error ) => {
22+ let message = `Failed to convert XML of '${ uri . path . slice ( 1 ) } ' to UDL.` ;
23+ if ( error . errorText && error . errorText !== "" ) {
24+ outputChannel . appendLine ( "\n" + error . errorText ) ;
25+ outputChannel . show ( true ) ;
26+ message += " Check 'ObjectScript' Output channel for details." ;
27+ }
28+ vscode . window . showErrorMessage ( message , "Dismiss" ) ;
29+ } ) ;
30+ } ) ;
1931 }
2032
2133 public get onDidChange ( ) : vscode . Event < vscode . Uri > {
You can’t perform that action at this time.
0 commit comments