forked from mlflow/mlflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make errors from RestStore more descriptive. (mlflow#582)
* init * address comments * address corey again
- Loading branch information
1 parent
1d9924a
commit 53de566
Showing
6 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import json | ||
|
||
from mlflow.exceptions import MlflowException | ||
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE | ||
|
||
|
||
class TestMlflowException(object): | ||
def test_error_code_constructor(self): | ||
assert MlflowException('test', error_code=INVALID_PARAMETER_VALUE).error_code == \ | ||
'INVALID_PARAMETER_VALUE' | ||
|
||
def test_default_error_code(self): | ||
assert MlflowException('test').error_code == 'INTERNAL_ERROR' | ||
|
||
def test_serialize_to_json(self): | ||
mlflow_exception = MlflowException('test') | ||
deserialized = json.loads(mlflow_exception.serialize_as_json()) | ||
assert deserialized['message'] == 'test' | ||
assert deserialized['error_code'] == 'INTERNAL_ERROR' |