import * as vscode from "vscode" ; import * as utils from "../../utils" ; export class ExceptionHelper { static logError ( channel , error , popupErrorMsg ) ; static logError ( channel , errorMsg , popupErrorMsg ) ; static logError ( channel , error , isPopupErrorMsg ) ; static logError ( channel , errorMsg , isPopupErrorMsg ) ; static logError ( channel , errorValue , popupValue ) { let _error ; let _message ; if ( typeof errorValue === "string" ) { _error = new Error ( errorValue ) ; _message = errorValue ; } else { _error = errorValue ; _message = errorValue . message ; } if ( popupValue === true ) { vscode . window . showErrorMessage ( _message ) ; } else if ( typeof popupValue === "string" ) { vscode . window . showErrorMessage ( popupValue ) ; } if ( channel ) { let errorMessage ; if ( _error . message ) { errorMessage = _error . message ; } else if ( ( _error as any ) . body && ( _error as any ) . body . message ) { errorMessage = ( _error as any ) . body . message ; } else { errorMessage = _error . toString ( ) ; } utils . channelShowAndAppendLine ( channel , errorMessage ) ; } } }