Repository: mlflow/mlflow

Issue:
[FR] Add MlflowException on the top level
### Willingness to contribute

No. I cannot contribute this feature at this time.

### Proposal Summary

Make `mlflow.exceptions.MlflowException` importable as `mlflow.MlflowException`.

### Motivation

> #### What is the use case for this feature?

Make it easier for users to catch MLflow errors.

> #### Why is this use case valuable to support for MLflow users in general?

^

> #### Why is this use case valuable to support for your project(s) or organization?

^

> #### Why is it currently difficult to achieve this use case?

The `mlflow.exceptions` module is not documented, so it's difficult for users to find out how to import and catch `MlflowException`.

### Details

_No response_

### What component(s) does this bug affect?

- [ ] `area/artifacts`: Artifact stores and artifact logging
- [ ] `area/build`: Build and test infrastructure for MLflow
- [ ] `area/docs`: MLflow documentation pages
- [ ] `area/examples`: Example code
- [ ] `area/model-registry`: Model Registry service, APIs, and the fluent client calls for Model Registry
- [ ] `area/models`: MLmodel format, model serialization/deserialization, flavors
- [ ] `area/pipelines`: Pipelines, Pipeline APIs, Pipeline configs, Pipeline Templates
- [ ] `area/projects`: MLproject format, project running backends
- [ ] `area/scoring`: MLflow Model server, model deployment tools, Spark UDFs
- [ ] `area/server-infra`: MLflow Tracking server backend
- [X] `area/tracking`: Tracking Service, tracking client APIs, autologging

### What interface(s) does this bug affect?

- [ ] `area/uiux`: Front-end, user experience, plotting, JavaScript, JavaScript dev server
- [ ] `area/docker`: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
- [ ] `area/sqlalchemy`: Use of SQLAlchemy in the Tracking Service or Model Registry
- [ ] `area/windows`: Windows support

### What language(s) does this bug affect?

- [ ] `language/r`: R APIs and clients
- [ ] `language/java`: Java APIs and clients
- [ ] `language/new`: Proposals for new client languages

### What integration(s) does this bug affect?

- [ ] `integrations/azure`: Azure and Azure ML integrations
- [ ] `integrations/sagemaker`: SageMaker integrations
- [ ] `integrations/databricks`: Databricks integrations


Discussion:
Could you elaborate more on this?

Absolutely, we just want to import `MlflowException` in this module: https://github.com/mlflow/mlflow/blob/master/mlflow/__init__.py so that users can access `MlflowException` as `mlflow.MlflowException`

Resolving patch:
diff --git a/mlflow/__init__.py b/mlflow/__init__.py
--- a/mlflow/__init__.py
+++ b/mlflow/__init__.py
@@ -46,6 +46,8 @@
 import mlflow.artifacts
 import mlflow.pipelines
 import mlflow.client
+import mlflow.exceptions
+
 
 # model flavors
 _model_flavors_supported = []
@@ -166,6 +168,7 @@
 evaluate = mlflow.models.evaluate
 last_active_run = mlflow.tracking.fluent.last_active_run
 MlflowClient = mlflow.client.MlflowClient
+MlflowException = mlflow.exceptions.MlflowException
 
 run = projects.run
 
@@ -212,4 +215,5 @@
     "evaluate",
     "last_active_run",
     "MlflowClient",
+    "MlflowException",
 ] + _model_flavors_supported


Test patch: