Repository: conan-io/conan
Pull request #17126 (2024-10-07 22:34:19)

moved exceptions conans->conan
Changelog: Omit
Docs: Omit

Pure refactor moved:
- public exceptions from ``conans.errors->conan.errors``
- private exceptions from ``conans.errors -> conan.internal.errors``


Patch:
diff --git a/conan/api/conan_api.py b/conan/api/conan_api.py
index 604e205e8..7c5f364bd 100644
--- a/conan/api/conan_api.py
+++ b/conan/api/conan_api.py
@@ -19,7 +19,7 @@ from conan.api.subapi.search import SearchAPI
 from conan.api.subapi.upload import UploadAPI
 from conans.client.migrations import ClientMigrator
 from conans.client.userio import init_colorama
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.version import Version
 from conan.internal.paths import get_conan_user_home
 from conans.model.version_range import validate_conan_version
diff --git a/conan/api/model.py b/conan/api/model.py
index abc5ebc84..e0c6fe91d 100644
--- a/conan/api/model.py
+++ b/conan/api/model.py
@@ -5,7 +5,8 @@ from json import JSONDecodeError
 
 from conans.client.graph.graph import RECIPE_EDITABLE, RECIPE_CONSUMER, RECIPE_PLATFORM, \
     RECIPE_VIRTUAL, BINARY_SKIP, BINARY_MISSING, BINARY_INVALID
-from conans.errors import ConanException, NotFoundException
+from conan.internal.errors import NotFoundException
+from conan.errors import ConanException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conans.util.files import load
diff --git a/conan/api/output.py b/conan/api/output.py
index f7fc1fe61..dd4a8e795 100644
--- a/conan/api/output.py
+++ b/conan/api/output.py
@@ -7,7 +7,7 @@ from threading import Lock
 from colorama import Fore, Style
 
 from conans.client.userio import color_enabled
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 LEVEL_QUIET = 80  # -q
 LEVEL_ERROR = 70  # Errors
diff --git a/conan/api/subapi/cache.py b/conan/api/subapi/cache.py
index dd62c1956..d347b2728 100644
--- a/conan/api/subapi/cache.py
+++ b/conan/api/subapi/cache.py
@@ -11,7 +11,7 @@ from conan.internal.cache.home_paths import HomePaths
 from conan.internal.conan_app import ConanApp
 from conan.internal.cache.integrity_check import IntegrityChecker
 from conans.client.downloaders.download_cache import DownloadCache
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conans.util.dates import revision_timestamp_now
diff --git a/conan/api/subapi/command.py b/conan/api/subapi/command.py
index 4405f3892..950e8bf5c 100644
--- a/conan/api/subapi/command.py
+++ b/conan/api/subapi/command.py
@@ -1,4 +1,4 @@
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 class CommandAPI:
diff --git a/conan/api/subapi/config.py b/conan/api/subapi/config.py
index c3ba8032c..57d0ec026 100644
--- a/conan/api/subapi/config.py
+++ b/conan/api/subapi/config.py
@@ -15,7 +15,7 @@ from conan.internal.default_settings import default_settings_yml
 from conans.client.graph.graph import CONTEXT_HOST, RECIPE_VIRTUAL, Node
 from conans.client.graph.graph_builder import DepsGraphBuilder
 from conans.client.graph.profile_node_definer import consumer_definer
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import ConfDefinition, BUILT_IN_CONFS
 from conans.model.pkg_type import PackageType
 from conans.model.recipe_ref import RecipeReference
diff --git a/conan/api/subapi/download.py b/conan/api/subapi/download.py
index 2ccb87c5d..1bd369557 100644
--- a/conan/api/subapi/download.py
+++ b/conan/api/subapi/download.py
@@ -5,7 +5,7 @@ from typing import Optional, List
 from conan.api.model import Remote, PackagesList
 from conan.api.output import ConanOutput
 from conan.internal.conan_app import ConanApp
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 
diff --git a/conan/api/subapi/graph.py b/conan/api/subapi/graph.py
index 2b5260587..b6ff4f844 100644
--- a/conan/api/subapi/graph.py
+++ b/conan/api/subapi/graph.py
@@ -5,7 +5,7 @@ from conans.client.graph.graph import Node, RECIPE_CONSUMER, CONTEXT_HOST, RECIP
 from conans.client.graph.graph_binaries import GraphBinariesAnalyzer
 from conans.client.graph.graph_builder import DepsGraphBuilder
 from conans.client.graph.profile_node_definer import initialize_conanfile_profile, consumer_definer
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 
 
diff --git a/conan/api/subapi/install.py b/conan/api/subapi/install.py
index adb134bc0..cf3a9c4e7 100644
--- a/conan/api/subapi/install.py
+++ b/conan/api/subapi/install.py
@@ -6,7 +6,7 @@ from conan.internal.deploy import do_deploys
 
 from conans.client.graph.install_graph import InstallGraph
 from conans.client.installer import BinaryInstaller
-from conans.errors import ConanInvalidConfiguration
+from conan.errors import ConanInvalidConfiguration
 
 
 class InstallAPI:
diff --git a/conan/api/subapi/list.py b/conan/api/subapi/list.py
index fecf61ab3..be074ec02 100644
--- a/conan/api/subapi/list.py
+++ b/conan/api/subapi/list.py
@@ -7,7 +7,8 @@ from conan.api.output import ConanOutput, TimedOutput
 from conan.internal.api.list.query_parse import filter_package_configs
 from conan.internal.conan_app import ConanApp
 from conan.internal.paths import CONANINFO
-from conans.errors import ConanException, NotFoundException
+from conan.internal.errors import NotFoundException
+from conan.errors import ConanException
 from conans.model.info import load_binary_info
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference, ref_matches
diff --git a/conan/api/subapi/local.py b/conan/api/subapi/local.py
index 224ef3dcd..7b252a6bd 100644
--- a/conan/api/subapi/local.py
+++ b/conan/api/subapi/local.py
@@ -7,7 +7,8 @@ from conans.client.conanfile.build import run_build_method
 from conans.client.graph.graph import CONTEXT_HOST
 from conans.client.graph.profile_node_definer import initialize_conanfile_profile
 from conans.client.source import run_source_method
-from conans.errors import ConanException, conanfile_exception_formatter
+from conan.internal.errors import conanfile_exception_formatter
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conans.util.files import chdir
 
diff --git a/conan/api/subapi/lockfile.py b/conan/api/subapi/lockfile.py
index 1d193bbcd..76a807179 100644
--- a/conan/api/subapi/lockfile.py
+++ b/conan/api/subapi/lockfile.py
@@ -3,7 +3,7 @@ import os
 from conan.api.output import ConanOutput
 from conan.cli import make_abs_path
 from conans.client.graph.graph import Overrides
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.graph_lock import Lockfile, LOCKFILE
 
 
diff --git a/conan/api/subapi/new.py b/conan/api/subapi/new.py
index 468123718..081f7e754 100644
--- a/conan/api/subapi/new.py
+++ b/conan/api/subapi/new.py
@@ -3,7 +3,7 @@ import os
 
 from jinja2 import Template, StrictUndefined
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.files import load
 from conans import __version__
 
diff --git a/conan/api/subapi/profiles.py b/conan/api/subapi/profiles.py
index d3849525a..065a178d4 100644
--- a/conan/api/subapi/profiles.py
+++ b/conan/api/subapi/profiles.py
@@ -5,7 +5,8 @@ from conan.internal.cache.home_paths import HomePaths
 
 from conans.client.loader import load_python_file
 from conan.internal.api.profile.profile_loader import ProfileLoader
-from conans.errors import ConanException, scoped_traceback
+from conan.internal.errors import scoped_traceback
+from conan.errors import ConanException
 from conans.model.profile import Profile
 
 DEFAULT_PROFILE_NAME = "default"
diff --git a/conan/api/subapi/remotes.py b/conan/api/subapi/remotes.py
index 23b31a225..77fe0dd34 100644
--- a/conan/api/subapi/remotes.py
+++ b/conan/api/subapi/remotes.py
@@ -10,7 +10,7 @@ from conan.internal.conan_app import ConanApp
 from conans.client.rest_client_local_recipe_index import add_local_recipes_index_remote, \
     remove_local_recipes_index_remote
 from conan.internal.api.remotes.localdb import LocalDB
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.files import save, load
 
 CONAN_CENTER_REMOTE_NAME = "conancenter"
diff --git a/conan/api/subapi/upload.py b/conan/api/subapi/upload.py
index 47bf8b1c3..0522096e6 100644
--- a/conan/api/subapi/upload.py
+++ b/conan/api/subapi/upload.py
@@ -8,7 +8,8 @@ from conan.internal.api.uploader import PackagePreparator, UploadExecutor, Uploa
     gather_metadata
 from conans.client.pkg_sign import PkgSignaturesPlugin
 from conans.client.rest.file_uploader import FileUploader
-from conans.errors import ConanException, AuthenticationException, ForbiddenException
+from conan.internal.errors import AuthenticationException, ForbiddenException
+from conan.errors import ConanException
 
 
 class UploadAPI:
diff --git a/conan/cli/commands/download.py b/conan/cli/commands/download.py
index dbaa4f73e..a7c72a0cc 100644
--- a/conan/cli/commands/download.py
+++ b/conan/cli/commands/download.py
@@ -4,7 +4,7 @@ from conan.api.output import ConanOutput
 from conan.cli import make_abs_path
 from conan.cli.command import conan_command, OnceArgument
 from conan.cli.commands.list import print_list_text, print_list_json
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 @conan_command(group="Creator", formatters={"text": print_list_text,
diff --git a/conan/cli/commands/export_pkg.py b/conan/cli/commands/export_pkg.py
index a47cdfe46..e61c5ce72 100644
--- a/conan/cli/commands/export_pkg.py
+++ b/conan/cli/commands/export_pkg.py
@@ -7,7 +7,7 @@ from conan.cli.command import conan_command, OnceArgument
 from conan.cli.commands.create import _get_test_conanfile_path
 from conan.cli.formatters.graph import format_graph_json
 from conan.cli.printers.graph import print_graph_basic
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 @conan_command(group="Creator", formatters={"json": format_graph_json})
diff --git a/conan/cli/commands/graph.py b/conan/cli/commands/graph.py
index a929f39f1..ee0c4164b 100644
--- a/conan/cli/commands/graph.py
+++ b/conan/cli/commands/graph.py
@@ -15,7 +15,7 @@ from conan.errors import ConanException
 from conan.internal.deploy import do_deploys
 from conans.client.graph.graph import BINARY_MISSING
 from conans.client.graph.install_graph import InstallGraph
-from conans.errors import NotFoundException
+from conan.internal.errors import NotFoundException
 from conans.model.recipe_ref import ref_matches, RecipeReference
 
 
diff --git a/conan/cli/commands/list.py b/conan/cli/commands/list.py
index ed700fe5e..41c383692 100644
--- a/conan/cli/commands/list.py
+++ b/conan/cli/commands/list.py
@@ -6,7 +6,7 @@ from conan.api.output import Color, cli_out_write
 from conan.cli import make_abs_path
 from conan.cli.command import conan_command, OnceArgument
 from conan.cli.formatters.list import list_packages_html
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.dates import timestamp_to_str
 
 
diff --git a/conan/cli/commands/pkglist.py b/conan/cli/commands/pkglist.py
index ee8d4aaaa..e4dc701a9 100644
--- a/conan/cli/commands/pkglist.py
+++ b/conan/cli/commands/pkglist.py
@@ -6,7 +6,7 @@ from conan.cli import make_abs_path
 from conan.cli.command import conan_command, conan_subcommand
 from conan.cli.commands.list import print_list_text, print_list_json
 from conan.cli.formatters.list import list_packages_html
-from conans.errors import NotFoundException
+from conan.internal.errors import NotFoundException
 
 
 @conan_command(group="Consumer")
diff --git a/conan/cli/commands/remove.py b/conan/cli/commands/remove.py
index 74ac93d99..85e925e79 100644
--- a/conan/cli/commands/remove.py
+++ b/conan/cli/commands/remove.py
@@ -5,7 +5,7 @@ from conan.cli import make_abs_path
 from conan.cli.command import conan_command, OnceArgument
 from conan.cli.commands.list import print_list_json, print_serial
 from conans.client.userio import UserInput
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 def summary_remove_list(results):
diff --git a/conan/errors.py b/conan/errors.py
index 1b237c2a9..b150a729e 100644
--- a/conan/errors.py
+++ b/conan/errors.py
@@ -1,3 +1,22 @@
-from conans.errors import ConanException
-from conans.errors import ConanInvalidConfiguration
-from conans.errors import ConanMigrationError
+class ConanException(Exception):
+    """ Generic conan exception """
+    def __init__(self, msg=None, remote=None):
+        self.remote = remote
+        super().__init__(msg)
+
+    def __str__(self):
+        msg = super().__str__()
+        if self.remote:
+            return f"{msg}. [Remote: {self.remote.name}]"
+        return msg
+
+
+class ConanInvalidConfiguration(ConanException):
+    """
+    This binary, for the requested configuration and package-id cannot be built
+    """
+    pass
+
+
+class ConanMigrationError(ConanException):
+    pass
diff --git a/conan/internal/api/config/config_installer.py b/conan/internal/api/config/config_installer.py
index 3a7e63679..d31569e90 100644
--- a/conan/internal/api/config/config_installer.py
+++ b/conan/internal/api/config/config_installer.py
@@ -7,7 +7,7 @@ from contextlib import contextmanager
 
 from conan.api.output import ConanOutput
 from conans.client.downloaders.file_downloader import FileDownloader
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.files import mkdir, rmdir, remove, unzip, chdir
 from conans.util.runners import detect_runner
 
diff --git a/conan/internal/api/detect/detect_vs.py b/conan/internal/api/detect/detect_vs.py
index 34859d7ca..613987039 100644
--- a/conan/internal/api/detect/detect_vs.py
+++ b/conan/internal/api/detect/detect_vs.py
@@ -3,7 +3,7 @@ import os
 from shutil import which
 
 from conan.tools.build import cmd_args_to_string
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 def vs_installation_path(version):
diff --git a/conan/internal/api/export.py b/conan/internal/api/export.py
index 279693fee..bc0d09c7a 100644
--- a/conan/internal/api/export.py
+++ b/conan/internal/api/export.py
@@ -4,7 +4,8 @@ import shutil
 from conan.tools.files import copy
 from conan.api.output import ConanOutput
 from conan.tools.scm import Git
-from conans.errors import ConanException, conanfile_exception_formatter
+from conan.internal.errors import conanfile_exception_formatter
+from conan.errors import ConanException
 from conans.model.manifest import FileTreeManifest
 from conans.model.recipe_ref import RecipeReference
 from conan.internal.paths import DATA_YML
diff --git a/conan/internal/api/install/generators.py b/conan/internal/api/install/generators.py
index 9b7de140d..3fd02da74 100644
--- a/conan/internal/api/install/generators.py
+++ b/conan/internal/api/install/generators.py
@@ -5,7 +5,8 @@ import importlib
 
 from conan.internal.cache.home_paths import HomePaths
 from conans.client.subsystems import deduce_subsystem, subsystem_path
-from conans.errors import ConanException, conanfile_exception_formatter
+from conan.internal.errors import conanfile_exception_formatter
+from conan.errors import ConanException
 from conans.util.files import save, mkdir, chdir
 
 _generators = {"CMakeToolchain": "conan.tools.cmake",
diff --git a/conan/internal/api/profile/profile_loader.py b/conan/internal/api/profile/profile_loader.py
index e9047054a..3ea76a379 100644
--- a/conan/internal/api/profile/profile_loader.py
+++ b/conan/internal/api/profile/profile_loader.py
@@ -9,7 +9,7 @@ from conan.api.output import ConanOutput
 from conan.internal.api.detect import detect_api
 from conan.internal.cache.home_paths import HomePaths
 from conan.tools.env.environment import ProfileEnvironment
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import ConfDefinition, CORE_CONF_PATTERN
 from conans.model.options import Options
 from conans.model.profile import Profile
diff --git a/conan/internal/api/uploader.py b/conan/internal/api/uploader.py
index 2cdf1ff2a..8d8b8a4d9 100644
--- a/conan/internal/api/uploader.py
+++ b/conan/internal/api/uploader.py
@@ -6,7 +6,8 @@ import time
 from conan.internal.conan_app import ConanApp
 from conan.api.output import ConanOutput
 from conans.client.source import retrieve_exports_sources
-from conans.errors import ConanException, NotFoundException
+from conan.internal.errors import NotFoundException
+from conan.errors import ConanException
 from conan.internal.paths import (CONAN_MANIFEST, CONANFILE, EXPORT_SOURCES_TGZ_NAME,
                                   EXPORT_TGZ_NAME, PACKAGE_TGZ_NAME, CONANINFO)
 from conans.util.files import (clean_dirty, is_dirty, gather_files,
diff --git a/conan/internal/cache/cache.py b/conan/internal/cache/cache.py
index 5a8e754f2..870ea2b29 100644
--- a/conan/internal/cache/cache.py
+++ b/conan/internal/cache/cache.py
@@ -10,7 +10,8 @@ from conan.internal.cache.conan_reference_layout import RecipeLayout, PackageLay
 # TODO: Random folders are no longer accessible, how to get rid of them asap?
 # TODO: We need the workflow to remove existing references.
 from conan.internal.cache.db.cache_database import CacheDatabase
-from conans.errors import ConanReferenceAlreadyExistsInDB, ConanException
+from conan.internal.errors import ConanReferenceAlreadyExistsInDB
+from conan.errors import ConanException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conans.util.dates import revision_timestamp_now
diff --git a/conan/internal/cache/db/packages_table.py b/conan/internal/cache/db/packages_table.py
index a5ec13b7a..9f066d9b7 100644
--- a/conan/internal/cache/db/packages_table.py
+++ b/conan/internal/cache/db/packages_table.py
@@ -1,7 +1,7 @@
 import sqlite3
 
 from conan.internal.cache.db.table import BaseDbTable
-from conans.errors import ConanReferenceDoesNotExistInDB, ConanReferenceAlreadyExistsInDB
+from conan.internal.errors import ConanReferenceDoesNotExistInDB, ConanReferenceAlreadyExistsInDB
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conans.util.dates import timestamp_now
diff --git a/conan/internal/cache/db/recipes_table.py b/conan/internal/cache/db/recipes_table.py
index fe40ab567..a6d413639 100644
--- a/conan/internal/cache/db/recipes_table.py
+++ b/conan/internal/cache/db/recipes_table.py
@@ -1,7 +1,7 @@
 import sqlite3
 
 from conan.internal.cache.db.table import BaseDbTable
-from conans.errors import ConanReferenceDoesNotExistInDB, ConanReferenceAlreadyExistsInDB
+from conan.internal.errors import ConanReferenceDoesNotExistInDB, ConanReferenceAlreadyExistsInDB
 from conans.model.recipe_ref import RecipeReference
 from conans.util.dates import timestamp_now
 
diff --git a/conan/internal/cache/integrity_check.py b/conan/internal/cache/integrity_check.py
index fa52d5362..e711701a5 100644
--- a/conan/internal/cache/integrity_check.py
+++ b/conan/internal/cache/integrity_check.py
@@ -1,7 +1,7 @@
 import os
 
 from conan.api.output import ConanOutput
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 
diff --git a/conan/internal/deploy.py b/conan/internal/deploy.py
index 05895794e..977bb0744 100644
--- a/conan/internal/deploy.py
+++ b/conan/internal/deploy.py
@@ -5,7 +5,8 @@ import shutil
 from conan.internal.cache.home_paths import HomePaths
 from conan.api.output import ConanOutput
 from conans.client.loader import load_python_file
-from conans.errors import ConanException, conanfile_exception_formatter
+from conan.internal.errors import conanfile_exception_formatter
+from conan.errors import ConanException
 from conans.util.files import rmdir, mkdir
 
 
diff --git a/conans/errors.py b/conan/internal/errors.py
similarity index 82%
rename from conans/errors.py
rename to conan/internal/errors.py
index 294658603..57c559e61 100644
--- a/conans/errors.py
+++ b/conan/internal/errors.py
@@ -1,15 +1,8 @@
-"""
-    Exceptions raised and handled in Conan
-    These exceptions are mapped between server (as an HTTP response) and client
-    through the REST API. When an error happens in server its translated to an HTTP
-    error code that its sent to client. Client reads the server code and raise the
-    matching exception.
-
-    see return_plugin.py
-"""
 import traceback
 from contextlib import contextmanager
 
+from conan.errors import ConanException, ConanInvalidConfiguration
+
 
 @contextmanager
 def conanfile_remove_attr(conanfile, names, method):
@@ -88,19 +81,6 @@ def scoped_traceback(header_msg, exception, scope):
     return ret
 
 
-class ConanException(Exception):
-    """ Generic conan exception """
-    def __init__(self, msg=None, remote=None):
-        self.remote = remote
-        super().__init__(msg)
-
-    def __str__(self):
-        msg = super().__str__()
-        if self.remote:
-            return f"{msg}. [Remote: {self.remote.name}]"
-        return msg
-
-
 class ConanReferenceDoesNotExistInDB(ConanException):
     """ Reference does not exist in cache db """
     pass
@@ -115,18 +95,6 @@ class ConanConnectionError(ConanException):
     pass
 
 
-class ConanInvalidConfiguration(ConanException):
-    """
-    This binary, for the requested configuration and package-id cannot be built
-    """
-    pass
-
-
-class ConanMigrationError(ConanException):
-    pass
-
-
-# Remote exceptions #
 class InternalErrorException(ConanException):
     """
          Generic 500 error
diff --git a/conan/internal/internal_tools.py b/conan/internal/internal_tools.py
index 195b65a76..ccf594e57 100644
--- a/conan/internal/internal_tools.py
+++ b/conan/internal/internal_tools.py
@@ -1,4 +1,4 @@
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 universal_arch_separator = '|'
 
diff --git a/conan/internal/runner/docker.py b/conan/internal/runner/docker.py
index b9f9ab8f1..5e57b066a 100644
--- a/conan/internal/runner/docker.py
+++ b/conan/internal/runner/docker.py
@@ -9,7 +9,7 @@ from conan.api.output import Color, ConanOutput
 from conan.api.conan_api import ConfigAPI
 from conan.cli import make_abs_path
 from conan.internal.runner import RunnerException
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.version import Version
 
 
diff --git a/conan/internal/runner/ssh.py b/conan/internal/runner/ssh.py
index 66aca5bd0..b6fb0ab00 100644
--- a/conan/internal/runner/ssh.py
+++ b/conan/internal/runner/ssh.py
@@ -3,7 +3,7 @@ import pathlib
 import tempfile
 
 from conan.api.output import Color, ConanOutput
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 import os
 from io import BytesIO
diff --git a/conan/internal/runner/wsl.py b/conan/internal/runner/wsl.py
index 3e4744b62..4d42f97e5 100644
--- a/conan/internal/runner/wsl.py
+++ b/conan/internal/runner/wsl.py
@@ -1,6 +1,6 @@
 from pathlib import PurePosixPath, PureWindowsPath, Path
 from conan.api.output import Color, ConanOutput
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.runners import conan_run
 from conans.client.subsystems import subsystem_path
 from conan.tools.files import save
@@ -61,7 +61,7 @@ class WSLRunner:
                 create_json_wsl = subsystem_path("wsl", create_json)
                 pkglist_json = PureWindowsPath(tmp_dir).joinpath("pkglist.json").as_posix()
                 pkglist_json_wsl = subsystem_path("wsl", pkglist_json)
-                
+
                 saved_cache = PureWindowsPath(tmp_dir).joinpath("saved_cache.tgz").as_posix()
                 saved_cache_wsl = subsystem_path("wsl", saved_cache)
                 conan_run(f"wsl.exe --cd {tmp_dir_wsl} -- CONAN_RUNNER_ENVIRONMENT=1 CONAN_HOME={self.remote_conan_home} {self.remote_conan} list --graph={create_json_wsl} --format=json > {pkglist_json}")
@@ -89,7 +89,7 @@ class WSLRunner:
         self.remote_conan_home = conan_home
 
         has_conan = conan_run(f"wsl.exe CONAN_HOME={conan_home.as_posix()} {remote_conan} --version", stdout=stdout, stderr=stderr) == 0
-        
+
         if not has_conan:
             wsl_info("Bootstrapping Conan in remote")
             conan_run(f"wsl.exe mkdir -p {remote_home}/.conan2remote")
@@ -109,7 +109,7 @@ class WSLRunner:
         # If this command succeeds, great - if not because it already exists, ignore
         conan_run(f"wsl.exe CONAN_HOME={conan_home.as_posix()} {remote_conan} profile detect", stdout=stdout, stderr=stderr)
 
-       
+
         conf_content = f"core.cache:storage_path={self.remote_conan_cache}\n"  if self.shared_cache else ""
         with tempfile.TemporaryDirectory() as tmp:
             global_conf = os.path.join(tmp, "global.conf")
@@ -117,7 +117,7 @@ class WSLRunner:
             global_conf_wsl = subsystem_path("wsl", global_conf)
             remote_global_conf = self.remote_conan_home.joinpath("global.conf")
             conan_run(f"wsl.exe cp {global_conf_wsl} {remote_global_conf}")
- 
+
         self._copy_profiles()
 
     def _copy_profiles(self):
@@ -137,7 +137,7 @@ class WSLRunner:
                 save(None, path=outfile, content=contents)
                 outfile_wsl = subsystem_path("wsl", outfile)
                 remote_profile = self.remote_conan_home.joinpath("profiles").as_posix() + "/"
-                
+
                 # This works but copies the file with executable attribute
                 conan_run(f"wsl.exe cp {outfile_wsl} {remote_profile}")
 
diff --git a/conan/tools/cmake/cmakedeps/templates/config_version.py b/conan/tools/cmake/cmakedeps/templates/config_version.py
index 8fdaa234c..db42be948 100644
--- a/conan/tools/cmake/cmakedeps/templates/config_version.py
+++ b/conan/tools/cmake/cmakedeps/templates/config_version.py
@@ -1,7 +1,7 @@
 import textwrap
 
 from conan.tools.cmake.cmakedeps.templates import CMakeDepsFileTemplate
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 """
     foo-config-version.cmake
diff --git a/conan/tools/files/copy_pattern.py b/conan/tools/files/copy_pattern.py
index ef0796da0..93de39d1e 100644
--- a/conan/tools/files/copy_pattern.py
+++ b/conan/tools/files/copy_pattern.py
@@ -3,7 +3,7 @@ import fnmatch
 import os
 import shutil
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.files import mkdir
 
 
diff --git a/conan/tools/gnu/gnutoolchain.py b/conan/tools/gnu/gnutoolchain.py
index d154f1cfb..96d90db0d 100644
--- a/conan/tools/gnu/gnutoolchain.py
+++ b/conan/tools/gnu/gnutoolchain.py
@@ -11,7 +11,7 @@ from conan.tools.build.flags import architecture_flag, build_type_flags, cppstd_
 from conan.tools.env import Environment
 from conan.tools.gnu.get_gnu_triplet import _get_gnu_triplet
 from conan.tools.microsoft import VCVars, msvc_runtime_flag, unix_path, check_min_vs, is_msvc
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.pkg_type import PackageType
 
 
diff --git a/conans/client/conanfile/build.py b/conans/client/conanfile/build.py
index 9a69809b6..743be2885 100644
--- a/conans/client/conanfile/build.py
+++ b/conans/client/conanfile/build.py
@@ -1,4 +1,4 @@
-from conans.errors import conanfile_exception_formatter
+from conan.internal.errors import conanfile_exception_formatter
 from conans.util.files import chdir, mkdir
 
 
diff --git a/conans/client/conanfile/configure.py b/conans/client/conanfile/configure.py
index 4b0aa99f1..bf99cb0e7 100644
--- a/conans/client/conanfile/configure.py
+++ b/conans/client/conanfile/configure.py
@@ -1,4 +1,4 @@
-from conans.errors import conanfile_exception_formatter
+from conan.internal.errors import conanfile_exception_formatter
 from conans.model.pkg_type import PackageType
 from conans.model.requires import BuildRequirements, TestRequirements, ToolRequirements
 from conans.client.conanfile.implementations import auto_shared_fpic_config_options, \
diff --git a/conans/client/conanfile/package.py b/conans/client/conanfile/package.py
index 12745e6bd..dd90d3138 100644
--- a/conans/client/conanfile/package.py
+++ b/conans/client/conanfile/package.py
@@ -1,7 +1,8 @@
 import os
 
 from conan.api.output import ConanOutput
-from conans.errors import ConanException, conanfile_exception_formatter, conanfile_remove_attr
+from conan.internal.errors import conanfile_remove_attr, conanfile_exception_formatter
+from conan.errors import ConanException
 from conans.model.manifest import FileTreeManifest
 from conans.model.package_ref import PkgReference
 from conan.internal.paths import CONANINFO
diff --git a/conans/client/downloaders/caching_file_downloader.py b/conans/client/downloaders/caching_file_downloader.py
index e6921e154..dc6f7f039 100644
--- a/conans/client/downloaders/caching_file_downloader.py
+++ b/conans/client/downloaders/caching_file_downloader.py
@@ -8,8 +8,8 @@ from conan.api.output import ConanOutput
 from conan.internal.cache.home_paths import HomePaths
 from conans.client.downloaders.file_downloader import FileDownloader
 from conans.client.downloaders.download_cache import DownloadCache
-from conans.errors import NotFoundException, ConanException, AuthenticationException, \
-    ForbiddenException
+from conan.internal.errors import AuthenticationException, ForbiddenException, NotFoundException
+from conan.errors import ConanException
 from conans.util.files import mkdir, set_dirty_context_manager, remove_if_dirty, human_size
 
 
diff --git a/conans/client/downloaders/download_cache.py b/conans/client/downloaders/download_cache.py
index fb3e16631..f38b32746 100644
--- a/conans/client/downloaders/download_cache.py
+++ b/conans/client/downloaders/download_cache.py
@@ -4,7 +4,7 @@ import os
 from contextlib import contextmanager
 from threading import Lock
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.dates import timestamp_now
 from conans.util.files import load, save, remove_if_dirty
 from conans.util.locks import simple_lock
diff --git a/conans/client/downloaders/file_downloader.py b/conans/client/downloaders/file_downloader.py
index 196a21005..19ac00b40 100644
--- a/conans/client/downloaders/file_downloader.py
+++ b/conans/client/downloaders/file_downloader.py
@@ -5,8 +5,9 @@ import time
 
 from conan.api.output import ConanOutput, TimedOutput
 from conans.client.rest import response_to_str
-from conans.errors import ConanException, NotFoundException, AuthenticationException, \
-    ForbiddenException, ConanConnectionError, RequestErrorException
+from conan.internal.errors import ConanConnectionError, RequestErrorException, AuthenticationException, \
+    ForbiddenException, NotFoundException
+from conan.errors import ConanException
 from conans.util.files import human_size, check_with_algorithm_sum
 
 
diff --git a/conans/client/graph/build_mode.py b/conans/client/graph/build_mode.py
index 8efbd99da..52d7e37c8 100644
--- a/conans/client/graph/build_mode.py
+++ b/conans/client/graph/build_mode.py
@@ -1,4 +1,4 @@
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import ref_matches
 
 
diff --git a/conans/client/graph/compatibility.py b/conans/client/graph/compatibility.py
index 4961c28c0..85e615502 100644
--- a/conans/client/graph/compatibility.py
+++ b/conans/client/graph/compatibility.py
@@ -4,7 +4,8 @@ from collections import OrderedDict
 from conan.internal.cache.home_paths import HomePaths
 from conans.client.graph.compute_pid import run_validate_package_id
 from conans.client.loader import load_python_file
-from conans.errors import conanfile_exception_formatter, ConanException, scoped_traceback
+from conan.internal.errors import conanfile_exception_formatter, scoped_traceback
+from conan.errors import ConanException
 
 # TODO: Define other compatibility besides applications
 _default_compat = """\
diff --git a/conans/client/graph/compute_pid.py b/conans/client/graph/compute_pid.py
index 4ba623185..9aa690bb9 100644
--- a/conans/client/graph/compute_pid.py
+++ b/conans/client/graph/compute_pid.py
@@ -1,7 +1,7 @@
 from collections import OrderedDict
 
-from conans.errors import conanfile_exception_formatter, ConanInvalidConfiguration, \
-    conanfile_remove_attr, ConanException
+from conan.internal.errors import conanfile_remove_attr, conanfile_exception_formatter
+from conan.errors import ConanException, ConanInvalidConfiguration
 from conans.model.info import ConanInfo, RequirementsInfo, RequirementInfo, PythonRequiresInfo
 from conans.client.conanfile.implementations import auto_header_only_package_id
 
diff --git a/conans/client/graph/graph_binaries.py b/conans/client/graph/graph_binaries.py
index 3fae7fc3e..7d1438540 100644
--- a/conans/client/graph/graph_binaries.py
+++ b/conans/client/graph/graph_binaries.py
@@ -13,8 +13,9 @@ from conans.client.graph.graph import (BINARY_BUILD, BINARY_CACHE, BINARY_DOWNLO
                                        BINARY_INVALID, BINARY_EDITABLE_BUILD, RECIPE_PLATFORM,
                                        BINARY_PLATFORM)
 from conans.client.graph.proxy import should_update_reference
-from conans.errors import NotFoundException, \
-    PackageNotFoundException, conanfile_exception_formatter, ConanConnectionError, ConanException
+from conan.internal.errors import conanfile_exception_formatter, ConanConnectionError, NotFoundException, \
+    PackageNotFoundException
+from conan.errors import ConanException
 from conans.model.info import RequirementInfo, RequirementsInfo
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
diff --git a/conans/client/graph/graph_builder.py b/conans/client/graph/graph_builder.py
index a442fa4a1..4a8f8d15d 100644
--- a/conans/client/graph/graph_builder.py
+++ b/conans/client/graph/graph_builder.py
@@ -11,7 +11,7 @@ from conans.client.graph.graph_error import GraphLoopError, GraphConflictError,
     GraphRuntimeError, GraphError
 from conans.client.graph.profile_node_definer import initialize_conanfile_profile
 from conans.client.graph.provides import check_graph_provides
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conan_file import ConanFile
 from conans.model.options import Options, _PackageOptions
 from conans.model.pkg_type import PackageType
diff --git a/conans/client/graph/graph_error.py b/conans/client/graph/graph_error.py
index a438b87be..d04373ae1 100644
--- a/conans/client/graph/graph_error.py
+++ b/conans/client/graph/graph_error.py
@@ -1,4 +1,4 @@
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 class GraphError(ConanException):
diff --git a/conans/client/graph/install_graph.py b/conans/client/graph/install_graph.py
index 63221cc32..d51f9082c 100644
--- a/conans/client/graph/install_graph.py
+++ b/conans/client/graph/install_graph.py
@@ -5,7 +5,7 @@ import textwrap
 from conan.api.output import ConanOutput
 from conans.client.graph.graph import RECIPE_CONSUMER, RECIPE_VIRTUAL, BINARY_SKIP, \
     BINARY_MISSING, BINARY_INVALID, Overrides, BINARY_BUILD, BINARY_EDITABLE_BUILD, BINARY_PLATFORM
-from conans.errors import ConanInvalidConfiguration, ConanException
+from conan.errors import ConanException, ConanInvalidConfiguration
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conans.util.files import load
diff --git a/conans/client/graph/profile_node_definer.py b/conans/client/graph/profile_node_definer.py
index 2b905ef0c..fb4c4a4a4 100644
--- a/conans/client/graph/profile_node_definer.py
+++ b/conans/client/graph/profile_node_definer.py
@@ -1,5 +1,5 @@
 from conans.client.graph.graph import CONTEXT_BUILD
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import ref_matches
 
 
diff --git a/conans/client/graph/proxy.py b/conans/client/graph/proxy.py
index 1621176b6..d7a364f97 100644
--- a/conans/client/graph/proxy.py
+++ b/conans/client/graph/proxy.py
@@ -3,7 +3,8 @@ from conan.internal.cache.conan_reference_layout import BasicLayout
 from conans.client.graph.graph import (RECIPE_DOWNLOADED, RECIPE_INCACHE, RECIPE_NEWER,
                                        RECIPE_NOT_IN_REMOTE, RECIPE_UPDATED, RECIPE_EDITABLE,
                                        RECIPE_INCACHE_DATE_UPDATED, RECIPE_UPDATEABLE)
-from conans.errors import ConanException, NotFoundException
+from conan.internal.errors import NotFoundException
+from conan.errors import ConanException
 
 
 class ConanProxy:
diff --git a/conans/client/graph/python_requires.py b/conans/client/graph/python_requires.py
index a861e53df..b9542ef5f 100644
--- a/conans/client/graph/python_requires.py
+++ b/conans/client/graph/python_requires.py
@@ -1,6 +1,6 @@
 import os
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conans.model.requires import Requirement
 
diff --git a/conans/client/graph/range_resolver.py b/conans/client/graph/range_resolver.py
index 31df11c37..bd21c44d1 100644
--- a/conans/client/graph/range_resolver.py
+++ b/conans/client/graph/range_resolver.py
@@ -1,5 +1,5 @@
 from conans.client.graph.proxy import should_update_reference
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conans.model.version_range import VersionRange
 
diff --git a/conans/client/hook_manager.py b/conans/client/hook_manager.py
index 2df571f42..d213b209d 100644
--- a/conans/client/hook_manager.py
+++ b/conans/client/hook_manager.py
@@ -1,7 +1,7 @@
 import os
 
 from conans.client.loader import load_python_file
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 valid_hook_methods = ["pre_export", "post_export",
                       "pre_source", "post_source",
diff --git a/conans/client/installer.py b/conans/client/installer.py
index b2937dda8..bdeb24efe 100644
--- a/conans/client/installer.py
+++ b/conans/client/installer.py
@@ -10,7 +10,8 @@ from conans.client.graph.graph import BINARY_BUILD, BINARY_CACHE, BINARY_DOWNLOA
     BINARY_UPDATE, BINARY_EDITABLE_BUILD, BINARY_SKIP
 from conans.client.graph.install_graph import InstallGraph
 from conans.client.source import retrieve_exports_sources, config_source
-from conans.errors import (ConanException, conanfile_exception_formatter, conanfile_remove_attr)
+from conan.internal.errors import conanfile_remove_attr, conanfile_exception_formatter
+from conan.errors import ConanException
 from conans.model.build_info import CppInfo, MockInfoProperty
 from conans.model.package_ref import PkgReference
 from conan.internal.paths import CONANINFO
diff --git a/conans/client/loader.py b/conans/client/loader.py
index c5760f68c..ecad28572 100644
--- a/conans/client/loader.py
+++ b/conans/client/loader.py
@@ -16,7 +16,8 @@ from conan.tools.cmake import cmake_layout
 from conan.tools.google import bazel_layout
 from conan.tools.microsoft import vs_layout
 from conans.client.loader_txt import ConanFileTextLoader
-from conans.errors import ConanException, NotFoundException, conanfile_exception_formatter
+from conan.internal.errors import conanfile_exception_formatter, NotFoundException
+from conan.errors import ConanException
 from conans.model.conan_file import ConanFile
 from conans.model.options import Options
 from conans.model.recipe_ref import RecipeReference
diff --git a/conans/client/loader_txt.py b/conans/client/loader_txt.py
index 3e33e06f9..10e70b3ea 100644
--- a/conans/client/loader_txt.py
+++ b/conans/client/loader_txt.py
@@ -1,4 +1,4 @@
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.config_parser import ConfigParser
 
 
diff --git a/conans/client/remote_manager.py b/conans/client/remote_manager.py
index 9aea240a6..e5d2defd7 100644
--- a/conans/client/remote_manager.py
+++ b/conans/client/remote_manager.py
@@ -10,8 +10,8 @@ from conan.api.model import Remote
 from conan.api.output import ConanOutput
 from conan.internal.cache.conan_reference_layout import METADATA
 from conans.client.pkg_sign import PkgSignaturesPlugin
-from conans.errors import ConanConnectionError, ConanException, NotFoundException, \
-    PackageNotFoundException
+from conan.internal.errors import ConanConnectionError, NotFoundException, PackageNotFoundException
+from conan.errors import ConanException
 from conans.model.info import load_binary_info
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
diff --git a/conans/client/rest/auth_manager.py b/conans/client/rest/auth_manager.py
index e241e9f8b..e67745ba8 100644
--- a/conans/client/rest/auth_manager.py
+++ b/conans/client/rest/auth_manager.py
@@ -14,7 +14,8 @@ Flow:
 from conan.api.output import ConanOutput
 from conans.client.rest.remote_credentials import RemoteCredentials
 from conans.client.rest.rest_client import RestApiClient
-from conans.errors import AuthenticationException, ConanException, ForbiddenException
+from conan.internal.errors import AuthenticationException, ForbiddenException
+from conan.errors import ConanException
 
 LOGIN_RETRIES = 3
 
diff --git a/conans/client/rest/conan_requester.py b/conans/client/rest/conan_requester.py
index 73974a79c..7b7762c7c 100644
--- a/conans/client/rest/conan_requester.py
+++ b/conans/client/rest/conan_requester.py
@@ -13,7 +13,8 @@ from conan.internal.cache.home_paths import HomePaths
 
 from conans import __version__ as client_version
 from conans.client.loader import load_python_file
-from conans.errors import ConanException, scoped_traceback
+from conan.internal.errors import scoped_traceback
+from conan.errors import ConanException
 
 # Capture SSL warnings as pointed out here:
 # https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
diff --git a/conans/client/rest/file_uploader.py b/conans/client/rest/file_uploader.py
index 1eadc2e6e..13dd9255f 100644
--- a/conans/client/rest/file_uploader.py
+++ b/conans/client/rest/file_uploader.py
@@ -3,8 +3,9 @@ import time
 
 from conan.api.output import ConanOutput, TimedOutput
 from conans.client.rest import response_to_str
-from conans.errors import AuthenticationException, ConanException, \
-    NotFoundException, ForbiddenException, RequestErrorException, InternalErrorException
+from conan.internal.errors import InternalErrorException, RequestErrorException, AuthenticationException, \
+    ForbiddenException, NotFoundException
+from conan.errors import ConanException
 from conans.util.files import sha1sum
 
 
diff --git a/conans/client/rest/remote_credentials.py b/conans/client/rest/remote_credentials.py
index ad001a576..c1107f192 100644
--- a/conans/client/rest/remote_credentials.py
+++ b/conans/client/rest/remote_credentials.py
@@ -9,7 +9,8 @@ from conan.internal.cache.home_paths import HomePaths
 from conans.client.loader import load_python_file
 from conan.api.output import ConanOutput
 from conans.client.userio import UserInput
-from conans.errors import ConanException, scoped_traceback
+from conan.internal.errors import scoped_traceback
+from conan.errors import ConanException
 from conans.util.files import load
 
 
diff --git a/conans/client/rest/rest_client.py b/conans/client/rest/rest_client.py
index e2dcf1714..27099a3f0 100644
--- a/conans/client/rest/rest_client.py
+++ b/conans/client/rest/rest_client.py
@@ -1,6 +1,6 @@
 from conans import CHECKSUM_DEPLOY, REVISIONS
 from conans.client.rest.rest_client_v2 import RestV2Methods
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 class RestApiClient:
diff --git a/conans/client/rest/rest_client_v2.py b/conans/client/rest/rest_client_v2.py
index b5b74255e..e4ffe9a82 100644
--- a/conans/client/rest/rest_client_v2.py
+++ b/conans/client/rest/rest_client_v2.py
@@ -13,8 +13,9 @@ from conans.client.downloaders.caching_file_downloader import ConanInternalCache
 from conans.client.rest import response_to_str
 from conans.client.rest.client_routes import ClientV2Router
 from conans.client.rest.file_uploader import FileUploader
-from conans.errors import ConanException, NotFoundException, PackageNotFoundException, \
-    RecipeNotFoundException, AuthenticationException, ForbiddenException, EXCEPTION_CODE_MAPPING
+from conan.internal.errors import AuthenticationException, ForbiddenException, NotFoundException, \
+    RecipeNotFoundException, PackageNotFoundException, EXCEPTION_CODE_MAPPING
+from conan.errors import ConanException
 from conans.model.package_ref import PkgReference
 from conan.internal.paths import EXPORT_SOURCES_TGZ_NAME
 from conans.model.recipe_ref import RecipeReference
diff --git a/conans/client/rest_client_local_recipe_index.py b/conans/client/rest_client_local_recipe_index.py
index 39de35508..2514b091d 100644
--- a/conans/client/rest_client_local_recipe_index.py
+++ b/conans/client/rest_client_local_recipe_index.py
@@ -11,8 +11,9 @@ from conan.api.output import ConanOutput
 from conan.internal.cache.home_paths import HomePaths
 from conan.internal.api.export import cmd_export
 from conans.client.loader import ConanFileLoader
-from conans.errors import ConanException, PackageNotFoundException, RecipeNotFoundException, \
-    ConanReferenceDoesNotExistInDB, NotFoundException
+from conan.internal.errors import ConanReferenceDoesNotExistInDB, NotFoundException, RecipeNotFoundException, \
+    PackageNotFoundException
+from conan.errors import ConanException
 from conans.model.conf import ConfDefinition
 from conans.model.recipe_ref import RecipeReference
 from conans.util.files import load, save, rmdir, copytree_compat
diff --git a/conans/client/source.py b/conans/client/source.py
index 6c7617242..9b0aee5b0 100644
--- a/conans/client/source.py
+++ b/conans/client/source.py
@@ -2,8 +2,8 @@ import os
 
 from conan.api.output import ConanOutput
 from conan.tools.env import VirtualBuildEnv
-from conans.errors import ConanException, conanfile_exception_formatter, NotFoundException, \
-    conanfile_remove_attr
+from conan.internal.errors import conanfile_remove_attr, conanfile_exception_formatter, NotFoundException
+from conan.errors import ConanException
 from conans.util.files import (is_dirty, mkdir, rmdir, set_dirty_context_manager,
                                merge_directories, clean_dirty, chdir)
 
diff --git a/conans/client/subsystems.py b/conans/client/subsystems.py
index 39654b147..e5fe65eaf 100644
--- a/conans/client/subsystems.py
+++ b/conans/client/subsystems.py
@@ -24,7 +24,7 @@ import platform
 import re
 
 from conan.tools.build import cmd_args_to_string
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 WINDOWS = "windows"
 MSYS2 = 'msys2'
diff --git a/conans/client/userio.py b/conans/client/userio.py
index 33c9628ff..bb1175e3d 100644
--- a/conans/client/userio.py
+++ b/conans/client/userio.py
@@ -2,7 +2,7 @@ import getpass
 import os
 import sys
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 def is_terminal(stream):
diff --git a/conans/migrations.py b/conans/migrations.py
index c455a0bb4..b47d8a6ef 100644
--- a/conans/migrations.py
+++ b/conans/migrations.py
@@ -3,7 +3,7 @@ import os
 from conan import conan_version
 from conan.api.output import ConanOutput
 from conans.client.loader import load_python_file
-from conans.errors import ConanException, ConanMigrationError
+from conan.errors import ConanException, ConanMigrationError
 from conans.model.version import Version
 from conans.util.files import load, save
 
diff --git a/conans/model/build_info.py b/conans/model/build_info.py
index b392c7f55..938a64d0e 100644
--- a/conans/model/build_info.py
+++ b/conans/model/build_info.py
@@ -4,7 +4,7 @@ import os
 from collections import OrderedDict, defaultdict
 
 from conan.api.output import ConanOutput
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.files import load, save
 
 _DIRS_VAR_NAMES = ["_includedirs", "_srcdirs", "_libdirs", "_resdirs", "_bindirs", "_builddirs",
diff --git a/conans/model/conan_file.py b/conans/model/conan_file.py
index 50cecb9b0..f61cee57d 100644
--- a/conans/model/conan_file.py
+++ b/conans/model/conan_file.py
@@ -3,7 +3,7 @@ from pathlib import Path
 
 from conan.api.output import ConanOutput, Color
 from conans.client.subsystems import command_env_wrapper
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.build_info import MockInfoProperty
 from conans.model.conf import Conf
 from conans.model.dependencies import ConanFileDependencies
diff --git a/conans/model/conf.py b/conans/model/conf.py
index bd5da94e7..15be356a1 100644
--- a/conans/model/conf.py
+++ b/conans/model/conf.py
@@ -6,7 +6,7 @@ import fnmatch
 
 from collections import OrderedDict
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import ref_matches
 
 BUILT_IN_CONFS = {
diff --git a/conans/model/dependencies.py b/conans/model/dependencies.py
index a2734b5e8..44a52125b 100644
--- a/conans/model/dependencies.py
+++ b/conans/model/dependencies.py
@@ -1,7 +1,7 @@
 from collections import OrderedDict
 
 from conans.client.graph.graph import RECIPE_PLATFORM
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conans.model.conanfile_interface import ConanFileInterface
 
diff --git a/conans/model/graph_lock.py b/conans/model/graph_lock.py
index e3c3fa9dc..b6272acc0 100644
--- a/conans/model/graph_lock.py
+++ b/conans/model/graph_lock.py
@@ -5,7 +5,7 @@ from collections import OrderedDict
 
 from conan.api.output import ConanOutput
 from conans.client.graph.graph import RECIPE_VIRTUAL, RECIPE_CONSUMER, CONTEXT_BUILD, Overrides
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conans.model.version_range import VersionRange
 from conans.util.files import load, save
diff --git a/conans/model/info.py b/conans/model/info.py
index 630f13104..c22c31013 100644
--- a/conans/model/info.py
+++ b/conans/model/info.py
@@ -1,6 +1,6 @@
 import hashlib
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.dependencies import UserRequirementsDict
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference, Version
diff --git a/conans/model/options.py b/conans/model/options.py
index cbf6eaf83..82ce0ba75 100644
--- a/conans/model/options.py
+++ b/conans/model/options.py
@@ -1,4 +1,4 @@
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import ref_matches
 
 _falsey_options = ["false", "none", "0", "off", ""]
diff --git a/conans/model/package_ref.py b/conans/model/package_ref.py
index da1ea5e0b..2980f71a2 100644
--- a/conans/model/package_ref.py
+++ b/conans/model/package_ref.py
@@ -1,4 +1,4 @@
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conans.util.dates import timestamp_to_str
 
diff --git a/conans/model/pkg_type.py b/conans/model/pkg_type.py
index 5d51d0488..29c207952 100644
--- a/conans/model/pkg_type.py
+++ b/conans/model/pkg_type.py
@@ -1,6 +1,6 @@
 from enum import Enum
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 class PackageType(Enum):
diff --git a/conans/model/recipe_ref.py b/conans/model/recipe_ref.py
index ca58c5984..6165ec4c9 100644
--- a/conans/model/recipe_ref.py
+++ b/conans/model/recipe_ref.py
@@ -3,7 +3,7 @@ import fnmatch
 import re
 from functools import total_ordering
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.version import Version
 from conans.util.dates import timestamp_to_str
 
@@ -120,7 +120,7 @@ class RecipeReference:
                 user = channel = None
             return RecipeReference(name, version, user, channel, revision, timestamp)
         except Exception:
-            from conans.errors import ConanException
+            from conan.errors import ConanException
             raise ConanException(
                 f"{rref} is not a valid recipe reference, provide a reference"
                 f" in the form name/version[@user/channel]")
diff --git a/conans/model/requires.py b/conans/model/requires.py
index 7b312b40e..d9a9dbc76 100644
--- a/conans/model/requires.py
+++ b/conans/model/requires.py
@@ -1,6 +1,6 @@
 from collections import OrderedDict
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.pkg_type import PackageType
 from conans.model.recipe_ref import RecipeReference
 from conans.model.version_range import VersionRange
diff --git a/conans/model/settings.py b/conans/model/settings.py
index 2c56f7a38..ed1c1ef42 100644
--- a/conans/model/settings.py
+++ b/conans/model/settings.py
@@ -1,7 +1,7 @@
 import yaml
 
 from conan.internal.internal_tools import is_universal_arch
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 def bad_value_msg(name, value, value_range):
diff --git a/conans/model/version.py b/conans/model/version.py
index 42d866b43..dd87b3586 100644
--- a/conans/model/version.py
+++ b/conans/model/version.py
@@ -1,6 +1,6 @@
 from functools import total_ordering
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 @total_ordering
diff --git a/conans/model/version_range.py b/conans/model/version_range.py
index 838d8e5ae..ee4e5906c 100644
--- a/conans/model/version_range.py
+++ b/conans/model/version_range.py
@@ -1,7 +1,7 @@
 from functools import total_ordering
 from typing import Optional
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import Version
 from conans import __version__ as client_version
 
diff --git a/conans/server/conf/__init__.py b/conans/server/conf/__init__.py
index 44a4e4029..a70911ec8 100644
--- a/conans/server/conf/__init__.py
+++ b/conans/server/conf/__init__.py
@@ -8,7 +8,7 @@ import string
 from datetime import timedelta
 from configparser import ConfigParser, NoSectionError
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.server.conf.default_server_conf import default_server_conf
 from conans.server.store.disk_adapter import ServerDiskAdapter
 from conans.server.store.server_store import ServerStore
diff --git a/conans/server/rest/api_v2.py b/conans/server/rest/api_v2.py
index 680f20ff4..f4e5ec866 100644
--- a/conans/server/rest/api_v2.py
+++ b/conans/server/rest/api_v2.py
@@ -1,6 +1,6 @@
 from bottle import Bottle
 
-from conans.errors import EXCEPTION_CODE_MAPPING
+from conan.internal.errors import EXCEPTION_CODE_MAPPING
 from conans.server.rest.bottle_plugins.http_basic_authentication import HttpBasicAuthentication
 from conans.server.rest.bottle_plugins.jwt_authentication import JWTAuthentication
 from conans.server.rest.bottle_plugins.return_handler import ReturnHandlerPlugin
diff --git a/conans/server/rest/bottle_plugins/return_handler.py b/conans/server/rest/bottle_plugins/return_handler.py
index 5ae25971c..31d75c814 100644
--- a/conans/server/rest/bottle_plugins/return_handler.py
+++ b/conans/server/rest/bottle_plugins/return_handler.py
@@ -1,6 +1,6 @@
 from bottle import HTTPResponse
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 class ReturnHandlerPlugin(object):
diff --git a/conans/server/rest/controller/v2/conan.py b/conans/server/rest/controller/v2/conan.py
index 4d1594a97..29c80770a 100644
--- a/conans/server/rest/controller/v2/conan.py
+++ b/conans/server/rest/controller/v2/conan.py
@@ -1,6 +1,6 @@
 from bottle import request
 
-from conans.errors import NotFoundException
+from conan.internal.errors import NotFoundException
 from conans.model.recipe_ref import RecipeReference
 from conans.server.rest.bottle_routes import BottleRoutes
 from conans.server.rest.controller.v2 import get_package_ref
diff --git a/conans/server/rest/controller/v2/users.py b/conans/server/rest/controller/v2/users.py
index 30f3624d0..378df02f1 100644
--- a/conans/server/rest/controller/v2/users.py
+++ b/conans/server/rest/controller/v2/users.py
@@ -1,6 +1,6 @@
 from bottle import response
 
-from conans.errors import AuthenticationException
+from conan.internal.errors import AuthenticationException
 
 from conans.server.rest.bottle_routes import BottleRoutes
 from conans.server.service.user_service import UserService
diff --git a/conans/server/service/authorize.py b/conans/server/service/authorize.py
index 7a40300b1..a6ce3df90 100644
--- a/conans/server/service/authorize.py
+++ b/conans/server/service/authorize.py
@@ -11,8 +11,7 @@ Replace this module with other that keeps the interface or super class.
 
 from abc import ABCMeta, abstractmethod
 
-from conans.errors import AuthenticationException, ForbiddenException, InternalErrorException
-
+from conan.internal.errors import InternalErrorException, AuthenticationException, ForbiddenException
 
 #  ############################################
 #  ############ ABSTRACT CLASSES ##############
diff --git a/conans/server/service/user_service.py b/conans/server/service/user_service.py
index 623e0c875..e4e58fd06 100644
--- a/conans/server/service/user_service.py
+++ b/conans/server/service/user_service.py
@@ -1,4 +1,4 @@
-from conans.errors import AuthenticationException
+from conan.internal.errors import AuthenticationException
 
 
 class UserService(object):
diff --git a/conans/server/service/v2/search.py b/conans/server/service/v2/search.py
index d4ce88a32..66a69c8e0 100644
--- a/conans/server/service/v2/search.py
+++ b/conans/server/service/v2/search.py
@@ -3,7 +3,7 @@ import os
 import re
 from fnmatch import translate
 
-from conans.errors import ForbiddenException, RecipeNotFoundException
+from conan.internal.errors import ForbiddenException, RecipeNotFoundException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conan.internal.paths import CONANINFO
diff --git a/conans/server/service/v2/service_v2.py b/conans/server/service/v2/service_v2.py
index be37b5d68..a7c0f158b 100644
--- a/conans/server/service/v2/service_v2.py
+++ b/conans/server/service/v2/service_v2.py
@@ -3,7 +3,7 @@ import os
 
 from bottle import FileUpload, static_file
 
-from conans.errors import RecipeNotFoundException, PackageNotFoundException, NotFoundException
+from conan.internal.errors import NotFoundException, RecipeNotFoundException, PackageNotFoundException
 from conan.internal.paths import CONAN_MANIFEST
 from conans.model.package_ref import PkgReference
 from conans.server.service.mime import get_mime_type
diff --git a/conans/server/store/disk_adapter.py b/conans/server/store/disk_adapter.py
index 941d1fe8b..30b3a308e 100644
--- a/conans/server/store/disk_adapter.py
+++ b/conans/server/store/disk_adapter.py
@@ -3,7 +3,7 @@ from contextlib import contextmanager
 
 import fasteners
 
-from conans.errors import NotFoundException
+from conan.internal.errors import NotFoundException
 from conans.util.files import md5sum, rmdir
 from conans.server.utils.files import path_exists, relative_dirs
 
diff --git a/conans/server/store/server_store.py b/conans/server/store/server_store.py
index e79e956a3..8f3fb7843 100644
--- a/conans/server/store/server_store.py
+++ b/conans/server/store/server_store.py
@@ -1,7 +1,8 @@
 import os
 from os.path import join, normpath, relpath
 
-from conans.errors import ConanException, PackageNotFoundException, RecipeNotFoundException
+from conan.internal.errors import RecipeNotFoundException, PackageNotFoundException
+from conan.errors import ConanException
 from conan.internal.paths import CONAN_MANIFEST
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
diff --git a/conans/util/config_parser.py b/conans/util/config_parser.py
index 9c526379d..3b2b98c1d 100644
--- a/conans/util/config_parser.py
+++ b/conans/util/config_parser.py
@@ -1,6 +1,6 @@
 import re
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 class ConfigParser(object):
diff --git a/conans/util/dates.py b/conans/util/dates.py
index 1881326af..9e01c667b 100644
--- a/conans/util/dates.py
+++ b/conans/util/dates.py
@@ -4,7 +4,7 @@ import time
 
 from dateutil import parser
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 def from_timestamp_to_iso8601(timestamp):
diff --git a/conans/util/files.py b/conans/util/files.py
index a47d95301..fd03715ee 100644
--- a/conans/util/files.py
+++ b/conans/util/files.py
@@ -11,8 +11,7 @@ import time
 
 from contextlib import contextmanager
 
-
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 _DIRTY_FOLDER = ".dirty"
 
diff --git a/conans/util/runners.py b/conans/util/runners.py
index 434bee38e..219d0f9ee 100644
--- a/conans/util/runners.py
+++ b/conans/util/runners.py
@@ -5,7 +5,7 @@ import tempfile
 from contextlib import contextmanager
 from io import StringIO
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.util.files import load
 
 


Test patch:
diff --git a/conan/test/utils/artifactory.py b/conan/test/utils/artifactory.py
index b3ab0fbe8..11e62ca0a 100644
--- a/conan/test/utils/artifactory.py
+++ b/conan/test/utils/artifactory.py
@@ -4,7 +4,7 @@ import uuid
 
 import requests
 
-from conans.errors import RecipeNotFoundException, PackageNotFoundException
+from conan.internal.errors import RecipeNotFoundException, PackageNotFoundException
 from conans.server.revision_list import _RevisionEntry
 
 ARTIFACTORY_DEFAULT_USER = os.getenv("ARTIFACTORY_DEFAULT_USER", "admin")
diff --git a/conan/test/utils/mocks.py b/conan/test/utils/mocks.py
index bfed795b6..acdb379c0 100644
--- a/conan/test/utils/mocks.py
+++ b/conan/test/utils/mocks.py
@@ -3,7 +3,7 @@ from io import StringIO
 
 from conan import ConanFile
 from conan.internal.conan_app import ConanFileHelpers
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import Conf
 from conans.model.layout import Folders, Infos
 from conans.model.options import Options
diff --git a/conan/test/utils/test_files.py b/conan/test/utils/test_files.py
index fa88b3bf2..d45701752 100644
--- a/conan/test/utils/test_files.py
+++ b/conan/test/utils/test_files.py
@@ -10,7 +10,7 @@ from io import BytesIO
 
 from conan.tools.files.files import untargz
 from conans.client.subsystems import get_cased_path
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.internal.paths import PACKAGE_TGZ_NAME
 from conans.util.files import gzopen_without_timestamps
 
diff --git a/conan/test/utils/tools.py b/conan/test/utils/tools.py
index a1f98a39a..f86cc8ce3 100644
--- a/conan/test/utils/tools.py
+++ b/conan/test/utils/tools.py
@@ -32,7 +32,8 @@ from conan.api.conan_api import ConanAPI
 from conan.api.model import Remote
 from conan.cli.cli import Cli, _CONAN_INTERNAL_CUSTOM_COMMANDS_PATH
 from conan.test.utils.env import environment_update
-from conans.errors import NotFoundException, ConanException
+from conan.internal.errors import NotFoundException
+from conan.errors import ConanException
 from conans.model.manifest import FileTreeManifest
 from conans.model.package_ref import PkgReference
 from conans.model.profile import Profile
diff --git a/test/functional/revisions_test.py b/test/functional/revisions_test.py
index bf052ca71..35387d956 100644
--- a/test/functional/revisions_test.py
+++ b/test/functional/revisions_test.py
@@ -7,7 +7,7 @@ import pytest
 from mock import patch
 
 from conan.test.utils.env import environment_update
-from conans.errors import RecipeNotFoundException
+from conan.internal.errors import RecipeNotFoundException
 from conans.model.recipe_ref import RecipeReference
 from conans.server.revision_list import RevisionList
 from conan.test.utils.tools import TestServer, TurboTestClient, GenConanfile, TestClient
diff --git a/test/functional/util/tools_test.py b/test/functional/util/tools_test.py
index b89fc1c58..c73fa5511 100644
--- a/test/functional/util/tools_test.py
+++ b/test/functional/util/tools_test.py
@@ -6,7 +6,7 @@ from shutil import which
 import pytest
 
 from conan.internal.api.detect.detect_vs import vswhere
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.env import environment_update
 
 
diff --git a/test/integration/cache/backup_sources_test.py b/test/integration/cache/backup_sources_test.py
index 5c72e6609..63c539acf 100644
--- a/test/integration/cache/backup_sources_test.py
+++ b/test/integration/cache/backup_sources_test.py
@@ -6,7 +6,8 @@ from unittest import mock
 import pytest
 from bottle import static_file, HTTPError, request
 
-from conans.errors import NotFoundException, ConanException
+from conan.internal.errors import NotFoundException
+from conan.errors import ConanException
 from conan.test.utils.file_server import TestFileServer
 from conan.test.utils.test_files import temp_folder
 from conan.test.utils.tools import TestClient, StoppableThreadBottle
diff --git a/test/integration/command/remove_test.py b/test/integration/command/remove_test.py
index f227ea509..c8b7bfee4 100644
--- a/test/integration/command/remove_test.py
+++ b/test/integration/command/remove_test.py
@@ -5,7 +5,7 @@ import unittest
 import pytest
 
 from conan.api.conan_api import ConanAPI
-from conans.errors import NotFoundException
+from conan.internal.errors import NotFoundException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conan.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient, TestServer, GenConanfile
diff --git a/test/integration/command/upload/upload_test.py b/test/integration/command/upload/upload_test.py
index a37008435..926d0dce7 100644
--- a/test/integration/command/upload/upload_test.py
+++ b/test/integration/command/upload/upload_test.py
@@ -10,7 +10,7 @@ import requests
 from mock import patch
 from requests import Response
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conan.internal.paths import EXPORT_SOURCES_TGZ_NAME, PACKAGE_TGZ_NAME
diff --git a/test/integration/command_v2/list_test.py b/test/integration/command_v2/list_test.py
index 63b167b92..54292f69c 100644
--- a/test/integration/command_v2/list_test.py
+++ b/test/integration/command_v2/list_test.py
@@ -8,7 +8,8 @@ from unittest.mock import patch, Mock
 
 import pytest
 
-from conans.errors import ConanException, ConanConnectionError
+from conan.internal.errors import ConanConnectionError
+from conan.errors import ConanException
 from conan.test.assets.genconanfile import GenConanfile
 from conan.test.utils.tools import TestClient, TestServer, NO_SETTINGS_PACKAGE_ID
 from conan.test.utils.env import environment_update
diff --git a/test/integration/command_v2/search_test.py b/test/integration/command_v2/search_test.py
index 352c86771..6d6ae26b3 100644
--- a/test/integration/command_v2/search_test.py
+++ b/test/integration/command_v2/search_test.py
@@ -4,7 +4,8 @@ from unittest.mock import patch, Mock
 
 import pytest
 
-from conans.errors import ConanConnectionError, ConanException
+from conan.internal.errors import ConanConnectionError
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conan.test.assets.genconanfile import GenConanfile
 from conan.test.utils.tools import TestClient, TestServer
diff --git a/test/integration/configuration/required_version_test.py b/test/integration/configuration/required_version_test.py
index eb69db7cb..58714e856 100644
--- a/test/integration/configuration/required_version_test.py
+++ b/test/integration/configuration/required_version_test.py
@@ -3,7 +3,7 @@ import unittest
 import mock
 
 from conans import __version__
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.test_files import temp_folder
 from conan.test.utils.tools import TestClient
 from conans.util.files import save
diff --git a/test/integration/graph/core/graph_manager_test.py b/test/integration/graph/core/graph_manager_test.py
index bf620c4ca..4c3dda4d4 100644
--- a/test/integration/graph/core/graph_manager_test.py
+++ b/test/integration/graph/core/graph_manager_test.py
@@ -2,7 +2,7 @@ import pytest
 from parameterized import parameterized
 
 from conans.client.graph.graph_error import GraphMissingError, GraphLoopError, GraphConflictError
-from conans.errors import ConanException
+from conan.errors import ConanException
 from test.integration.graph.core.graph_manager_base import GraphManagerTest
 from conan.test.utils.tools import GenConanfile
 
diff --git a/test/integration/graph/test_validate_build.py b/test/integration/graph/test_validate_build.py
index c05a68db2..ff5afb38f 100644
--- a/test/integration/graph/test_validate_build.py
+++ b/test/integration/graph/test_validate_build.py
@@ -10,7 +10,7 @@ def test_basic_validate_build_test():
     t = TestClient()
     conanfile = textwrap.dedent("""
     from conan import ConanFile
-    from conans.errors import ConanInvalidConfiguration
+    from conan.errors import ConanInvalidConfiguration
 
     class myConan(ConanFile):
         name = "foo"
@@ -57,7 +57,7 @@ def test_with_options_validate_build_test():
     t = TestClient(light=True)
     conanfile = textwrap.dedent("""
     from conan import ConanFile
-    from conans.errors import ConanInvalidConfiguration
+    from conan.errors import ConanInvalidConfiguration
 
     class myConan(ConanFile):
         name = "foo"
diff --git a/test/integration/remote/auth_test.py b/test/integration/remote/auth_test.py
index be9f6d5f8..80aacdcb8 100644
--- a/test/integration/remote/auth_test.py
+++ b/test/integration/remote/auth_test.py
@@ -6,7 +6,7 @@ import unittest
 from requests.models import Response
 
 from conan.internal.api.remotes.localdb import LocalDB
-from conans.errors import AuthenticationException
+from conan.internal.errors import AuthenticationException
 from conans.model.recipe_ref import RecipeReference
 from conan.internal.paths import CONANFILE
 from conan.test.assets.genconanfile import GenConanfile
diff --git a/test/integration/remote/retry_test.py b/test/integration/remote/retry_test.py
index e5cba085f..dd3e85981 100644
--- a/test/integration/remote/retry_test.py
+++ b/test/integration/remote/retry_test.py
@@ -5,7 +5,7 @@ from collections import namedtuple, Counter
 from requests.exceptions import HTTPError
 
 from conans.client.rest.file_uploader import FileUploader
-from conans.errors import AuthenticationException, ForbiddenException
+from conan.internal.errors import AuthenticationException, ForbiddenException
 from conan.test.utils.mocks import RedirectedTestOutput
 from conan.test.utils.test_files import temp_folder
 from conan.test.utils.tools import redirect_output
diff --git a/test/integration/tools/system/package_manager_test.py b/test/integration/tools/system/package_manager_test.py
index b769b4e0b..5eb052bac 100644
--- a/test/integration/tools/system/package_manager_test.py
+++ b/test/integration/tools/system/package_manager_test.py
@@ -7,7 +7,7 @@ from unittest.mock import PropertyMock
 
 from conan.tools.system.package_manager import Apt, Apk, Dnf, Yum, Brew, Pkg, PkgUtil, Chocolatey, \
     Zypper, PacMan, _SystemPackageManagerTool
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.settings import Settings
 from conan.test.utils.mocks import ConanFileMock, MockSettings
 
diff --git a/test/unittests/cli/common_test.py b/test/unittests/cli/common_test.py
index 47c428252..b62c6e483 100644
--- a/test/unittests/cli/common_test.py
+++ b/test/unittests/cli/common_test.py
@@ -5,7 +5,7 @@ import pytest
 
 from conan.api.conan_api import ConanAPI
 from conan.internal.cache.home_paths import HomePaths
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.test_files import temp_folder
 from conans.util.files import save
 
diff --git a/test/unittests/client/conanfile_loader_test.py b/test/unittests/client/conanfile_loader_test.py
index 69ebb92c1..9bfd97d8d 100644
--- a/test/unittests/client/conanfile_loader_test.py
+++ b/test/unittests/client/conanfile_loader_test.py
@@ -7,7 +7,7 @@ import pytest
 from parameterized import parameterized
 
 from conans.client.loader import ConanFileLoader, ConanFileTextLoader, load_python_file
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.test_files import temp_folder
 from conans.util.files import save, chdir
 
diff --git a/test/unittests/client/graph/build_mode_test.py b/test/unittests/client/graph/build_mode_test.py
index b760f7078..653dd053a 100644
--- a/test/unittests/client/graph/build_mode_test.py
+++ b/test/unittests/client/graph/build_mode_test.py
@@ -1,7 +1,7 @@
 import pytest
 
 from conans.client.graph.build_mode import BuildMode
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conan.test.utils.mocks import ConanFileMock, RedirectedTestOutput
 from conan.test.utils.tools import redirect_output
diff --git a/test/unittests/client/migrations/test_migrator.py b/test/unittests/client/migrations/test_migrator.py
index 66a38636e..f8224cff5 100644
--- a/test/unittests/client/migrations/test_migrator.py
+++ b/test/unittests/client/migrations/test_migrator.py
@@ -3,7 +3,7 @@ import platform
 
 import pytest
 
-from conans.errors import ConanMigrationError
+from conan.errors import ConanMigrationError
 from conans.migrations import Migrator
 from conan.test.utils.test_files import temp_folder
 
diff --git a/test/unittests/client/profile_loader/compiler_cppstd_test.py b/test/unittests/client/profile_loader/compiler_cppstd_test.py
index af73239e1..f2468f7a0 100644
--- a/test/unittests/client/profile_loader/compiler_cppstd_test.py
+++ b/test/unittests/client/profile_loader/compiler_cppstd_test.py
@@ -9,7 +9,7 @@ from conan.internal.cache.cache import PkgCache
 from conan.internal.cache.home_paths import HomePaths
 from conan.internal.api.profile.profile_loader import ProfileLoader
 from conan.internal.default_settings import default_settings_yml
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import ConfDefinition
 from conans.model.settings import Settings
 from conan.test.utils.test_files import temp_folder
diff --git a/test/unittests/client/profile_loader/profile_loader_test.py b/test/unittests/client/profile_loader/profile_loader_test.py
index b62722b80..9e20d9c5e 100644
--- a/test/unittests/client/profile_loader/profile_loader_test.py
+++ b/test/unittests/client/profile_loader/profile_loader_test.py
@@ -4,7 +4,7 @@ import textwrap
 import pytest
 
 from conan.internal.api.profile.profile_loader import _ProfileParser, ProfileLoader
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 from conan.test.utils.mocks import ConanFileMock, MockSettings
 from conan.test.utils.test_files import temp_folder
diff --git a/test/unittests/client/rest/downloader_test.py b/test/unittests/client/rest/downloader_test.py
index a5b8464c1..b63415358 100644
--- a/test/unittests/client/rest/downloader_test.py
+++ b/test/unittests/client/rest/downloader_test.py
@@ -6,7 +6,7 @@ import unittest
 import pytest
 
 from conans.client.downloaders.file_downloader import FileDownloader
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 class MockResponse(object):
diff --git a/test/unittests/client/rest/uploader_test.py b/test/unittests/client/rest/uploader_test.py
index 53daf468c..4777ccd21 100644
--- a/test/unittests/client/rest/uploader_test.py
+++ b/test/unittests/client/rest/uploader_test.py
@@ -3,7 +3,7 @@ import unittest
 from collections import namedtuple
 
 from conans.client.rest.file_uploader import FileUploader
-from conans.errors import AuthenticationException, ForbiddenException, InternalErrorException
+from conan.internal.errors import InternalErrorException, AuthenticationException, ForbiddenException
 from conans.util.files import save
 
 
diff --git a/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py b/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py
index e5afa10d7..3ad840120 100644
--- a/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py
+++ b/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py
@@ -5,7 +5,7 @@ import pytest
 
 from conan.tools.build import load_toolchain_args
 from conan.tools.gnu import AutotoolsToolchain
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import Conf
 from conan.test.utils.mocks import ConanFileMock, MockSettings, MockOptions
 from conan.test.utils.test_files import temp_folder
diff --git a/test/unittests/client/tools/cppstd_required_test.py b/test/unittests/client/tools/cppstd_required_test.py
index 683fc4bbc..8da43ebb8 100644
--- a/test/unittests/client/tools/cppstd_required_test.py
+++ b/test/unittests/client/tools/cppstd_required_test.py
@@ -4,7 +4,7 @@ from parameterized import parameterized
 
 from conan.tools.build import check_max_cppstd, check_min_cppstd, valid_max_cppstd, valid_min_cppstd
 from conan.test.utils.mocks import MockSettings, ConanFileMock
-from conans.errors import ConanInvalidConfiguration, ConanException
+from conan.errors import ConanException, ConanInvalidConfiguration
 
 
 def _create_conanfile(compiler, version, os, cppstd, libcxx=None):
diff --git a/test/unittests/model/options_test.py b/test/unittests/model/options_test.py
index 447e80ca3..24ddc72da 100644
--- a/test/unittests/model/options_test.py
+++ b/test/unittests/model/options_test.py
@@ -2,7 +2,7 @@ import textwrap
 
 import pytest
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.options import Options
 from conans.model.recipe_ref import RecipeReference
 
diff --git a/test/unittests/model/settings_test.py b/test/unittests/model/settings_test.py
index d03c9cc3c..0c63f49f1 100644
--- a/test/unittests/model/settings_test.py
+++ b/test/unittests/model/settings_test.py
@@ -4,7 +4,7 @@ import unittest
 import pytest
 
 from conan.internal.default_settings import default_settings_yml
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.settings import Settings, bad_value_msg, undefined_field
 
 
diff --git a/test/unittests/model/test_conf.py b/test/unittests/model/test_conf.py
index e73870a45..f0d155a74 100644
--- a/test/unittests/model/test_conf.py
+++ b/test/unittests/model/test_conf.py
@@ -2,7 +2,7 @@ import textwrap
 
 import pytest
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import ConfDefinition
 
 
diff --git a/test/unittests/model/test_recipe_reference.py b/test/unittests/model/test_recipe_reference.py
index d0cc0ca4b..382424c1c 100644
--- a/test/unittests/model/test_recipe_reference.py
+++ b/test/unittests/model/test_recipe_reference.py
@@ -1,6 +1,6 @@
 import pytest
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.recipe_ref import RecipeReference
 
 
diff --git a/test/unittests/model/version/test_version_range.py b/test/unittests/model/version/test_version_range.py
index 629363160..5ac8d0850 100644
--- a/test/unittests/model/version/test_version_range.py
+++ b/test/unittests/model/version/test_version_range.py
@@ -2,7 +2,7 @@ import textwrap
 
 import pytest
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.version import Version
 from conans.model.version_range import VersionRange
 from conan.test.utils.tools import TestClient
diff --git a/test/unittests/server/conan_server_config_parser_test.py b/test/unittests/server/conan_server_config_parser_test.py
index c4197e48e..151720610 100644
--- a/test/unittests/server/conan_server_config_parser_test.py
+++ b/test/unittests/server/conan_server_config_parser_test.py
@@ -2,7 +2,7 @@
 import os
 import unittest
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.server.conf import ConanServerConfigParser
 from conan.test.utils.test_files import temp_folder
 from conans.util.files import mkdir, save
diff --git a/test/unittests/server/conf_test.py b/test/unittests/server/conf_test.py
index 1020ed7e0..c9528fb64 100644
--- a/test/unittests/server/conf_test.py
+++ b/test/unittests/server/conf_test.py
@@ -2,7 +2,7 @@ import os
 import unittest
 from datetime import timedelta
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.server.conf import ConanServerConfigParser
 from conan.test.utils.test_files import temp_folder
 from conans.util.config_parser import ConfigParser
diff --git a/test/unittests/server/service/authorizer_test.py b/test/unittests/server/service/authorizer_test.py
index 27a8ffdaf..1c80b8fe7 100644
--- a/test/unittests/server/service/authorizer_test.py
+++ b/test/unittests/server/service/authorizer_test.py
@@ -1,6 +1,6 @@
 import unittest
 
-from conans.errors import AuthenticationException, ForbiddenException, InternalErrorException
+from conan.internal.errors import InternalErrorException, AuthenticationException, ForbiddenException
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
 from conans.server.service.authorize import BasicAuthorizer
diff --git a/test/unittests/server/service/service_test.py b/test/unittests/server/service/service_test.py
index 80c50943f..97c90f33c 100644
--- a/test/unittests/server/service/service_test.py
+++ b/test/unittests/server/service/service_test.py
@@ -2,7 +2,7 @@ import copy
 import os
 import unittest
 
-from conans.errors import NotFoundException
+from conan.internal.errors import NotFoundException
 from conans.model.manifest import FileTreeManifest
 from conans.model.package_ref import PkgReference
 from conans.model.recipe_ref import RecipeReference
diff --git a/test/unittests/source/merge_directories_test.py b/test/unittests/source/merge_directories_test.py
index f840906d8..6edff9290 100644
--- a/test/unittests/source/merge_directories_test.py
+++ b/test/unittests/source/merge_directories_test.py
@@ -5,7 +5,7 @@ from os.path import join
 
 import pytest
 
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.test_files import temp_folder
 from conans.util.files import mkdir, save, merge_directories, load
 
diff --git a/test/unittests/tools/android/test_android_tools.py b/test/unittests/tools/android/test_android_tools.py
index 508cdd52d..b0acc977d 100644
--- a/test/unittests/tools/android/test_android_tools.py
+++ b/test/unittests/tools/android/test_android_tools.py
@@ -1,5 +1,5 @@
 from conan.test.utils.mocks import ConanFileMock, MockSettings
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.tools.android import android_abi
 
 from pytest import raises
diff --git a/test/unittests/tools/apple/test_apple_tools.py b/test/unittests/tools/apple/test_apple_tools.py
index dddaa6ccb..a54350f8a 100644
--- a/test/unittests/tools/apple/test_apple_tools.py
+++ b/test/unittests/tools/apple/test_apple_tools.py
@@ -3,7 +3,7 @@ import pytest
 import textwrap
 
 from conan.internal.internal_tools import is_universal_arch
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.mocks import ConanFileMock, MockSettings, MockOptions
 from conan.test.utils.test_files import temp_folder
 from conan.tools.apple import is_apple_os, to_apple_arch, fix_apple_shared_install_name, XCRun
diff --git a/test/unittests/tools/build/test_cppstd.py b/test/unittests/tools/build/test_cppstd.py
index 943a64288..1a4f6f80d 100644
--- a/test/unittests/tools/build/test_cppstd.py
+++ b/test/unittests/tools/build/test_cppstd.py
@@ -2,7 +2,7 @@ import pytest
 
 from conan.internal.api.detect.detect_api import detect_cppstd
 from conan.tools.build import supported_cppstd, check_min_cppstd, valid_min_cppstd
-from conans.errors import ConanException, ConanInvalidConfiguration
+from conan.errors import ConanException, ConanInvalidConfiguration
 from conans.model.version import Version
 from conan.test.utils.mocks import MockSettings, ConanFileMock
 
diff --git a/test/unittests/tools/cmake/test_cmaketoolchain.py b/test/unittests/tools/cmake/test_cmaketoolchain.py
index 09ba6d0fd..5eb8d43be 100644
--- a/test/unittests/tools/cmake/test_cmaketoolchain.py
+++ b/test/unittests/tools/cmake/test_cmaketoolchain.py
@@ -7,7 +7,7 @@ from conan import ConanFile
 from conan.internal.default_settings import default_settings_yml
 from conan.tools.cmake import CMakeToolchain
 from conan.tools.cmake.toolchain.blocks import Block
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import Conf
 from conans.model.options import Options
 from conans.model.settings import Settings
diff --git a/test/unittests/tools/files/test_downloads.py b/test/unittests/tools/files/test_downloads.py
index f58990027..165001b46 100644
--- a/test/unittests/tools/files/test_downloads.py
+++ b/test/unittests/tools/files/test_downloads.py
@@ -4,7 +4,8 @@ import shutil
 import pytest
 
 from conan.tools.files import ftp_download, download, get
-from conans.errors import ConanException, AuthenticationException
+from conan.internal.errors import AuthenticationException
+from conan.errors import ConanException
 from conan.test.utils.file_server import TestFileServer
 from conan.test.utils.mocks import ConanFileMock, RedirectedTestOutput
 from conan.test.utils.test_files import temp_folder
diff --git a/test/unittests/tools/files/test_patches.py b/test/unittests/tools/files/test_patches.py
index 4327f55a7..34708b39d 100644
--- a/test/unittests/tools/files/test_patches.py
+++ b/test/unittests/tools/files/test_patches.py
@@ -4,7 +4,7 @@ import patch_ng
 import pytest
 
 from conan.tools.files import patch, apply_conandata_patches
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.mocks import ConanFileMock, RedirectedTestOutput
 from conan.test.utils.tools import redirect_output
 
diff --git a/test/unittests/tools/files/test_toolchain.py b/test/unittests/tools/files/test_toolchain.py
index 5e2abf6c8..8fcc06c5d 100644
--- a/test/unittests/tools/files/test_toolchain.py
+++ b/test/unittests/tools/files/test_toolchain.py
@@ -5,7 +5,7 @@ import pytest
 
 from conan.tools.build import load_toolchain_args, save_toolchain_args, CONAN_TOOLCHAIN_ARGS_FILE, \
     CONAN_TOOLCHAIN_ARGS_SECTION
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.test_files import temp_folder
 from conans.util.files import save, load
 
diff --git a/test/unittests/tools/gnu/autotoolschain_test.py b/test/unittests/tools/gnu/autotoolschain_test.py
index 8c56c2d73..37096e970 100644
--- a/test/unittests/tools/gnu/autotoolschain_test.py
+++ b/test/unittests/tools/gnu/autotoolschain_test.py
@@ -4,7 +4,7 @@ import pytest
 
 from conan.tools.build import cmd_args_to_string
 from conan.tools.gnu import AutotoolsToolchain
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import Conf
 from conan.test.utils.mocks import ConanFileMock, MockSettings
 
diff --git a/test/unittests/tools/gnu/test_gnutoolchain.py b/test/unittests/tools/gnu/test_gnutoolchain.py
index 99668506c..cf053530e 100644
--- a/test/unittests/tools/gnu/test_gnutoolchain.py
+++ b/test/unittests/tools/gnu/test_gnutoolchain.py
@@ -4,7 +4,7 @@ import pytest
 
 from conan.tools.build import cmd_args_to_string
 from conan.tools.gnu import GnuToolchain
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import Conf
 from conan.test.utils.mocks import ConanFileMock, MockSettings
 
diff --git a/test/unittests/tools/gnu/test_triplets.py b/test/unittests/tools/gnu/test_triplets.py
index be0719140..626479576 100644
--- a/test/unittests/tools/gnu/test_triplets.py
+++ b/test/unittests/tools/gnu/test_triplets.py
@@ -1,7 +1,7 @@
 import pytest
 
 from conan.tools.gnu.get_gnu_triplet import _get_gnu_triplet, _get_gnu_os, _get_gnu_arch
-from conans.errors import ConanException
+from conan.errors import ConanException
 
 
 @pytest.mark.parametrize("os_, arch, compiler, expected", [
diff --git a/test/unittests/tools/intel/test_intel_cc.py b/test/unittests/tools/intel/test_intel_cc.py
index 8b9a6d4b3..788ff4107 100644
--- a/test/unittests/tools/intel/test_intel_cc.py
+++ b/test/unittests/tools/intel/test_intel_cc.py
@@ -6,7 +6,7 @@ from mock import patch
 
 from conan.tools.build.flags import architecture_flag, cppstd_flag
 from conan.tools.intel import IntelCC
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.conf import ConfDefinition
 from conan.test.utils.mocks import ConanFileMock, MockSettings
 
diff --git a/test/unittests/tools/microsoft/test_check_min_vs.py b/test/unittests/tools/microsoft/test_check_min_vs.py
index a480e163d..3afa2eb75 100644
--- a/test/unittests/tools/microsoft/test_check_min_vs.py
+++ b/test/unittests/tools/microsoft/test_check_min_vs.py
@@ -1,7 +1,7 @@
 import pytest
 
 from conan.tools.microsoft import check_min_vs
-from conans.errors import ConanInvalidConfiguration
+from conan.errors import ConanInvalidConfiguration
 from conan.test.utils.mocks import ConanFileMock, MockSettings
 
 
diff --git a/test/unittests/util/file_hashes_test.py b/test/unittests/util/file_hashes_test.py
index b7ae5f038..7115e8e1f 100644
--- a/test/unittests/util/file_hashes_test.py
+++ b/test/unittests/util/file_hashes_test.py
@@ -2,7 +2,7 @@ import os
 import unittest
 
 from conan.tools.files import check_md5, check_sha1, check_sha256
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conan.test.utils.mocks import ConanFileMock
 from conan.test.utils.test_files import temp_folder
 from conans.util.files import save
diff --git a/test/unittests/util/files/strip_root_extract_test.py b/test/unittests/util/files/strip_root_extract_test.py
index 1b8f8e5ac..cdbdb7b4a 100644
--- a/test/unittests/util/files/strip_root_extract_test.py
+++ b/test/unittests/util/files/strip_root_extract_test.py
@@ -4,7 +4,7 @@ import unittest
 import zipfile
 
 from conan.tools.files.files import untargz, unzip
-from conans.errors import ConanException
+from conan.errors import ConanException
 from conans.model.manifest import gather_files
 from conan.test.utils.mocks import ConanFileMock
 from conan.test.utils.mocks import RedirectedTestOutput