Skip to content

Commit

Permalink
fix: Wrap exception to add helpful exception message (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeDongGeon1996 authored Mar 5, 2024
1 parent 1efc646 commit e5f25cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions stock_indicators/_cslib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
load(runtime="coreclr")
import clr
except Exception as e:
e.add_note("Stock Indicators for Python has a dependency on CLR.\n"
"Install .NET SDK 6.0 (or newer) in your environment to add the required CLR capability.")
raise e
raise ImportError("Stock Indicators for Python has a dependency on CLR.\n"
"Install .NET SDK 6.0 (or newer) in your environment to add the required CLR capability.") from e

skender_stock_indicators_dll_path = os.path.join(
os.path.dirname(__file__),
Expand Down
5 changes: 2 additions & 3 deletions stock_indicators/_cstypes/decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ def __new__(cls, decimal) -> CsDecimal:
try:
return CsDecimal.Parse(str(decimal))
except CsFormatException as e:
e.add_note("You may be using numeric data that is incompatible with your locale environment settings.\n"
"For example, you may be using decimal points instead of commas.")
raise e
raise ValueError("You may be using numeric data that is incompatible with your locale environment settings.\n"
"For example, you may be using decimal points instead of commas.") from e


def to_pydecimal(cs_decimal):
Expand Down

0 comments on commit e5f25cd

Please sign in to comment.