|
52 | 52 | import org.eclipse.milo.opcua.stack.core.types.structured.VariableAttributes; |
53 | 53 |
|
54 | 54 | import java.util.ArrayList; |
| 55 | +import java.util.Arrays; |
55 | 56 | import java.util.List; |
56 | 57 | import java.util.Objects; |
57 | 58 | import java.util.function.Predicate; |
@@ -139,22 +140,39 @@ private void transferTabletRowForClientServerModel( |
139 | 140 | if (!result.getStatusCode().equals(StatusCode.GOOD) |
140 | 141 | && !(result.getStatusCode().getValue() == StatusCodes.Bad_NodeIdExists)) { |
141 | 142 | throw new PipeException( |
142 | | - "Failed to create nodes after transfer data value, write status: " |
143 | | - + writeStatus |
144 | | - + ", creation status: " |
145 | | - + addStatus); |
| 143 | + "Failed to create nodes after transfer data value, creation status: " |
| 144 | + + addStatus |
| 145 | + + getErrorString(segments, opcDataType, value, writeStatus)); |
146 | 146 | } |
147 | 147 | } |
148 | 148 | writeStatus = client.writeValue(nodeId, dataValue).get(); |
149 | 149 | if (writeStatus.getValue() != StatusCode.GOOD.getValue()) { |
150 | 150 | throw new PipeException( |
151 | | - "Failed to transfer dataValue after successfully created nodes, error: " + writeStatus); |
| 151 | + "Failed to transfer dataValue after successfully created nodes" |
| 152 | + + getErrorString(segments, opcDataType, value, writeStatus)); |
152 | 153 | } |
153 | | - } else if (writeStatus.getValue() != StatusCode.GOOD.getValue()){ |
154 | | - throw new PipeException("Failed to transfer dataValue, error: " + writeStatus); |
| 154 | + } else if (writeStatus.getValue() != StatusCode.GOOD.getValue()) { |
| 155 | + throw new PipeException( |
| 156 | + "Failed to transfer dataValue" |
| 157 | + + getErrorString(segments, opcDataType, value, writeStatus)); |
155 | 158 | } |
156 | 159 | } |
157 | 160 |
|
| 161 | + private static String getErrorString( |
| 162 | + final String[] segments, |
| 163 | + final NodeId dataType, |
| 164 | + final Object value, |
| 165 | + final StatusCode writeStatus) { |
| 166 | + return ", segments: " |
| 167 | + + Arrays.toString(segments) |
| 168 | + + ", dataType: " |
| 169 | + + dataType |
| 170 | + + ", value: " |
| 171 | + + value |
| 172 | + + ", error: " |
| 173 | + + writeStatus; |
| 174 | + } |
| 175 | + |
158 | 176 | public List<AddNodesItem> getNodesToAdd( |
159 | 177 | final String[] segments, final NodeId opcDataType, final Variant initialValue) { |
160 | 178 | final List<AddNodesItem> addNodesItems = new ArrayList<>(); |
|
0 commit comments