Skip to content

Commit 70cb21e

Browse files
committed
Get: Pass error received from server back up via future
1 parent 4d6d4d8 commit 70cb21e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/pva/src/main/java/org/epics/pva/client/GetRequest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019 Oak Ridge National Laboratory.
2+
* Copyright (c) 2019-2022 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -104,7 +104,7 @@ public void handleResponse(final ByteBuffer buffer) throws Exception
104104
final byte subcmd = buffer.get();
105105
PVAStatus status = PVAStatus.decode(buffer);
106106
if (! status.isSuccess())
107-
throw new Exception(channel + " Get Response for " + request + ": " + status);
107+
fail(new Exception(channel + " Get Response for " + request + ": " + status));
108108

109109
if (subcmd == PVAHeader.CMD_SUB_INIT)
110110
{
@@ -147,6 +147,12 @@ public void handleResponse(final ByteBuffer buffer) throws Exception
147147
}
148148
}
149149

150+
/** Handle failure by both notifying whoever waits for this request to complete
151+
* and by throwing exception
152+
*
153+
* @param ex Error description
154+
* @throws Exception
155+
*/
150156
private void fail(final Exception ex) throws Exception
151157
{
152158
completeExceptionally(ex);

0 commit comments

Comments
 (0)