import { setUserError } from "vscode-extension-telemetry-wrapper" ; import { promptToSettingMavenExecutable } from "./mavenUtils" ; import { showTroubleshootingDialog } from "./uiUtils" ; export class UserError extends Error { constructor ( msg ? ) { super ( msg ) ; setUserError ( this ) ; } } export class MavenNotFoundError extends UserError { constructor ( ) { super ( "Maven executable not found." ) ; } } export class OperationCanceledError extends UserError { } export class JavaExtensionNotActivatedError extends Error { constructor ( msg ? ) { super ( msg ) ; setUserError ( this ) ; } } export async function generalErrorHandler ( commandName , error ) { if ( error instanceof OperationCanceledError ) { } else if ( error instanceof MavenNotFoundError ) { await promptToSettingMavenExecutable ( ) ; } else { await showTroubleshootingDialog ( `Command "${ commandName }" fails. ${ error . message }` ) ; } throw error ; }