import os from "os" ; import LoggedError from "errors/LoggedError" ; /** An Error thrown during directory-related operations. */ class DirectoryError extends LoggedError { param message param sourcePath param destinationPath constructor ( message , sourcePath ? , destinationPath ? ) { super ( DirectoryError . constructErrorMessage ( message , sourcePath , destinationPath ) ) ; Error . captureStackTrace ( this , DirectoryError ) ; } param message param sourcePath param destinationPath private static constructErrorMessage ( message , sourcePath ? , destinationPath ? ) { let result = message ; if ( sourcePath ) { result += `${ os . EOL }Source directory item: ${ sourcePath }` ; } if ( destinationPath ) { result += `${ os . EOL }Destination directory item: ${ destinationPath }` ; } return result ; } } export default DirectoryError ;