Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error check/message in array() #4183

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

jmao-denver
Copy link
Contributor

Fixes #4167

@@ -202,6 +202,9 @@ def array(dtype: DType, seq: Sequence, remap: Callable[[Any], Any] = None) -> jp
Raises:
DHError
"""
if not isinstance(dtype, DType):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, we really need to do this? Python will let you just pass any type you want?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's Python, the idiomatic approach is to not check the type of the argument but maybe the value, but we have a problem with the raise statement in the try/except block that intends to provide the Java class name in the message:
except Exception as e: raise DHError(e, f"failed to create a Java {dtype.j_name} array.") from e

@jmao-denver jmao-denver merged commit b4d092f into deephaven:main Jul 17, 2023
16 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 17, 2023
@jmao-denver jmao-denver deleted the 4167-dtypes-array-errmsg branch July 17, 2023 14:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error message from dtypes.array
3 participants