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

Not correct Exception on expect operation #59

Open
WestDragon opened this issue Oct 18, 2018 · 2 comments
Open

Not correct Exception on expect operation #59

WestDragon opened this issue Oct 18, 2018 · 2 comments

Comments

@WestDragon
Copy link

WestDragon commented Oct 18, 2018

in class SingleInputExpect on method R expect(long timeoutMs, Matcher matcher) throws IOException on 105 line;

If copierFuture contains a thread with an exception (example SocketException) method return IOException with message Expect operation fails (timeout: 20000 ms) for matcher: contains('<-/MSG1>')].

But this message is not true.

2018-10-18 23 24 04

2018-10-18 23 24 43

maybe this solve problem:
`

if (copierFuture == null) {
        throw new IllegalStateException("Not started");
    }
    if (copierFuture.isCancelled()){
        throw new IllegalStateException("Future is canceled");
    }
    try {
        copierFuture.get();
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    } catch (ExecutionException e) {
        try {
            throw e.getCause();
        } catch (IOException ioEx) {
            throw ioEx;
        } catch (Throwable throwable) {
            throw new RuntimeException(throwable);
        }
    }

`

@agavrilov76
Copy link
Owner

If you change your application code to log the exception object, not only the message, you will see the root cause of the IOException (ie Socket exception) thrown from the library, something like this:

Logger.error("Expect matching error", e);

@starlightdreamer
Copy link

I'm confused at what is not correct. I see <-/ and </ two different things in the 2nd screenshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants