@@ -9,18 +9,21 @@ import { CommitDetails, FileCommitDetails } from '../common/types';
99import { IServiceContainer } from '../ioc/types' ;
1010import { Avatar , CommittedFile , IGitService , IGitServiceFactory , LogEntries , LogEntriesResponse , LogEntry , Ref , RefType } from '../types' ;
1111import { IApiRouteHandler } from './types' ;
12+ import { IApplicationShell } from '../application/types' ;
1213
1314// tslint:disable-next-line:no-require-imports no-var-requires
1415
1516@injectable ( )
1617export class ApiController implements IApiRouteHandler {
1718 private readonly commitViewer : IGitCommitViewDetailsCommandHandler ;
19+ private readonly applicationShell : IApplicationShell ;
1820 constructor ( private app : Express ,
1921 private gitServiceFactory : IGitServiceFactory ,
2022 private serviceContainer : IServiceContainer ,
2123 private commandManager : ICommandManager ) {
2224
2325 this . commitViewer = this . serviceContainer . get < IGitCommitViewDetailsCommandHandler > ( IGitCommitViewDetailsCommandHandler ) ;
26+ this . applicationShell = this . serviceContainer . get < IApplicationShell > ( IApplicationShell ) ;
2427
2528 this . app . get ( '/log' , this . handleRequest ( this . getLogEntries . bind ( this ) ) ) ;
2629 this . app . get ( '/branches' , this . handleRequest ( this . getBranches . bind ( this ) ) ) ;
@@ -167,6 +170,7 @@ export class ApiController implements IApiRouteHandler {
167170 }
168171 response . status ( 200 ) . send ( '' ) ;
169172 } catch ( err ) {
173+ this . applicationShell . showErrorMessage ( err ) ;
170174 response . status ( 500 ) . send ( err ) ;
171175 }
172176 }
@@ -204,6 +208,7 @@ export class ApiController implements IApiRouteHandler {
204208 }
205209 response . status ( 200 ) . send ( logEntry ) ;
206210 } catch ( err ) {
211+ this . applicationShell . showErrorMessage ( err ) ;
207212 response . status ( 500 ) . send ( err ) ;
208213 }
209214 }
0 commit comments