Files
PyPortfolioOpt/pypfopt/exceptions.py
2020-04-27 22:24:19 +08:00

25 lines
597 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
The ``exceptions`` module houses custom exceptions. Currently implemented:
- OptimizationError
"""
import traceback
class OptimizationError(Exception):
"""
When an optimization routine fails usually, this means
that cvxpy has not returned the "optimal" flag.
"""
def __init__(self, *args, **kwargs):
default_message = (
"Please check your objectives/constraints or use a different solver."
)
if not (args or kwargs):
args = (default_message,)
super().__init__(*args, **kwargs)
traceback.print_exc()