Opened 8 years ago
Closed 8 years ago
#14015 closed enhancement (fixed)
pt_assistant: use builder pattern for TestError
Reported by: | simon04 | Owned by: | darya |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Plugin pt_assistant | Version: | |
Keywords: | Cc: |
Attachments (0)
Change History (8)
comment:1 by , 8 years ago
comment:4 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:5 by , 8 years ago
@simon04 I understand the need for the builder to make sure the TestError always has primitives and a message. But why should it be impossible to change the error message later?
This is where I use the TestError.setMessage() method in the pt_assistant plugin:
In step#1 I check for each route relation if it is continuous. If not, a TestError is created, with all the "primitives" and "highlighted" objects that belong to it.
In step#2 I check if some of those non-continuous route relations can be fixed based on other continuous ones. Depending on how many fix variants there are (0, 1 or >1), pt_assistant will ask for a different type of response from the user. At this stage, I want to change the error message accordingly (0, 1 or >1 fixes available).
In other words, I cannot set the right message before I have visited all route relations. If the TestError.setMessage() method is gone, then I have to create a new TestError every time I just want to change the message, and update the Collections that contain that TestError => things slow down.
follow-up: 7 comment:6 by , 8 years ago
The idea of #13799 is to make TestError
an immutable class. Before calling TestError.Builder#build
you are free to modify TestError.Builder#message
/TestError.Builder#messageWithManuallyTranslatedDescription
as often as desired.
comment:7 by , 8 years ago
comment:8 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Thanks for the message, working on it.