File tree Expand file tree Collapse file tree
src/app/services/powershell Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111
1212### Changed
1313- ** [ AppLogger] :** : introduce debug instance
14+ - ** [ event-viewer] :** : adds debug loging when command execution throws error
1415
1516### Fixed
1617- ** [ log-selection] :** event-logs command parsing when thousands separator is '.' instead of ','
Original file line number Diff line number Diff line change 11import Shell from 'node-powershell' ;
22import { GlobalUtils } from '../global-utils' ;
3+ import { AppLogger } from '../AppLogger' ;
34
45
56
@@ -35,7 +36,13 @@ export class PsCommandExecutor {
3536 . then ( ( ) => _ps . addCommand ( command ) )
3637 . then ( ( ) => _ps . invoke ( ) )
3738 . catch ( e => {
38- if ( ! ignoreError ) console . error ( e ) ;
39+ if ( ! ignoreError ) {
40+ console . error ( 'The following command threw an error.\n' + command ) ;
41+ console . error ( e ) ;
42+ AppLogger . getDebug ( ) . logErrorMessage ( 'The following command threw an error.\n' + command ) ;
43+ AppLogger . getDebug ( ) . logError ( e ) ;
44+ }
45+
3946 return '' ;
4047 } )
4148 . finally ( ( ) => {
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ export class PowershellCommands {
5050 if ( computerName ) command += ` -ComputerName "${ computerName } "` ;
5151 command += ' -List' ;
5252
53- AppLogger . getDebug ( ) . logDebug ( command ) ;
5453 return PsCommandExecutor . executeCommand ( command , false , 90 )
5554 . then ( output => PowershellCommands . _parseEventViewersList ( output ) )
5655 . then ( events => {
@@ -96,7 +95,7 @@ export class PowershellCommands {
9695 //add select part
9796 command += PowershellCommands . _selectEventCommand ;
9897 //execute and parse
99- return PsCommandExecutor . executeCommand ( command , true )
98+ return PsCommandExecutor . executeCommand ( command , lastEvent == null )
10099 . then ( output => PowershellCommands . _parseEventsCommandOutput ( output ) ) ;
101100 }
102101
You can’t perform that action at this time.
0 commit comments