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

BUG: Rework API for DataMap and DeepCopy in DataObject. #864

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

imikejackson
Copy link
Contributor

We need to be able to report errors back up the call tree if possible.

@imikejackson imikejackson added bug Something isn't working enhancement New feature or request labels Feb 19, 2024
@imikejackson imikejackson force-pushed the topic/deep_copy_failures branch 2 times, most recently from 5f6a520 to 943f344 Compare March 27, 2024 22:37
@imikejackson imikejackson force-pushed the develop branch 2 times, most recently from 67a7875 to 12c9140 Compare April 22, 2024 14:34
@nyoungbq nyoungbq self-requested a review May 2, 2024 16:14
@imikejackson
Copy link
Contributor Author

@JDuffeyBQ @mmarineBlueQuartz @nyoungbq Did we want to actually do something more with this as in changing the API? Otherwise I'll rename the PR to something like "Updating error message"

@nyoungbq
Copy link
Contributor

nyoungbq commented May 2, 2024

@imikejackson I'm gonna be honest, it's been a while, so I don't really remember exactly what API this PR was aiming to fix in the first place. However, if the point is percolating errors up the call tree as the description suggests then I think it's a good idea to go further with this, since it will be easier to debug and more stable.

@imikejackson
Copy link
Contributor Author

I think there was some early discussion on slack about this. But, yes, I think the issue is that the error should be percolated up the call chain instead of just crashing at runtime. Either that or every call that uses this API should be put inside of a try-catch in order to not crash.

@imikejackson imikejackson force-pushed the topic/deep_copy_failures branch 3 times, most recently from 1425cc2 to e15f583 Compare May 17, 2024 21:37
imikejackson and others added 3 commits May 24, 2024 13:29
We need to be able to report errors back up the call tree if possible.

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
Co-authored-by: Nathan Young <nathan.young@bluequartz.net>
Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
}
if(m_DataMap.insert(ptr))
{
ptr->addParent(this);
return true;
return {true};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return {true};
return {{true}};

Since we use std::expected (from extraneous nonstd library) I believe we need the second bracket to construct it inside the Result object to pass it to the default constructor. This ensures that the valid() and invalid() Result wrapper methods function correctly. @JDuffeyBQ should probably verify I am correct in this behavior since I'm shaky on how the result is intended to function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that issue was with a particular version of gcc. Testing on my Windows machine both ways compile and produce the same result.

Also in this particular case Result<bool> is redundant since the result already conveys the success or failure so it should just be Result<void>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a lot of places that this is going to hit. I'm slowly going down this rabbit hole a bit at a time.

@JDuffeyBQ Ironically I started off with a Result<> but then changed to Result thinking that is what was needed. But you are correct in the fact that you return a "MakeErrorResult" will set the result to invalid, so that works.

{
return MakeErrorResult<bool>(-1674, fmt::format("AttributeMatrix: CanInsert() Failed with object {}. totalTuples={} incomingTupleCount={}", obj->getName(), totalTuples, incomingTupleCount));
}
return {true};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return {true};
return {{true}};

Same justification

}
return true;
return {true};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return {true};
return {{true}};

Same justification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants