Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Conversation

@rkondratowicz
Copy link
Contributor

Should simplify using the library a bit, just provide the data relevant to the 'type' of result.


group 'uk.gov.hmcts.reform'
version '0.0.1'
version '0.1.0'
Copy link
Contributor Author

@rkondratowicz rkondratowicz Jul 5, 2019

Choose a reason for hiding this comment

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

breaking change (class became abstract)


boolean shouldCreateCase = result.errors.isEmpty() && (result.warnings.isEmpty() || req.ignoreWarnings);
return handleTransformationResult(
transformer.transform(req.exceptionRecord),
Copy link
Contributor

Choose a reason for hiding this comment

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

This argument could also be a function. We should handle exceptions thrown by it, perhaps by wrapping them in some tranformation-specific exception.

Copy link
Contributor Author

@rkondratowicz rkondratowicz Jul 8, 2019

Choose a reason for hiding this comment

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

Not sure, it's the code provided by the users of the library, it can just throw exception from their code directly. Also no need for a function here imho, it's always called.

The shorter the stacktrace the better probably.

Let's focus on the new 2 types of results on this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, exception handling and logging can be done separately. The reason why I wanted function was to catch its exceptions. Those could also be caught at this level, doesn't matter that much.

I think it's clearer when the library throws an exception saying that custom transformation code threw an exception, rather than NullPointerException or whatever happened. It increases the likelihood of product teams realising that the problem occurred in their transformer and wasn't a bug in the library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Let's discuss separately.

boolean shouldCreateCase = result.errors.isEmpty() && (result.warnings.isEmpty() || req.ignoreWarnings);
return handleTransformationResult(
transformer.transform(req.exceptionRecord),
okRes -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is minor and can stay as it is, but my suggestion is to change okRest and errRes to full names.


import java.util.List;

public class OkTransformationResult implements TransformationResult {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should go with Ok... or Success.... Not very important, anyway.

@rkondratowicz rkondratowicz merged commit 2f112a2 into master Jul 8, 2019
@rkondratowicz rkondratowicz deleted the feature/add-subclasses-for-transformation-result branch July 8, 2019 10:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants