Skip to content

Commit

Permalink
Show criteria upon search timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Jun 12, 2024
1 parent e721d14 commit 267692c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/com/mailosaur/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import java.util.List;

import com.google.api.client.http.HttpResponse;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonSerializer;
import com.mailosaur.models.*;

/**
Expand Down Expand Up @@ -335,7 +339,9 @@ public MessageListResult search(MessageSearchParams params, SearchCriteria crite
if (params.errorOnTimeout() == false) {
return result;
}
throw new MailosaurException("No matching messages found in time. By default, only messages received in the last hour are checked (use receivedAfter to override this).", "search_timeout");

String criteriaJson = new Gson().toJson(criteria);
throw new MailosaurException("No matching messages found in time. By default, only messages received in the last hour are checked (use receivedAfter to override this). The search criteria used for this query was ["+criteriaJson+"] which timed out after "+params.timeout()+"ms", "search_timeout");
}

try {
Expand Down

0 comments on commit 267692c

Please sign in to comment.