Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/com/hellosign/sdk/HelloSignException.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public HelloSignException(String message, Throwable e) {
super(message, e);
}

public HelloSignException(String message, Integer httpCode) {
this(message, httpCode, null, null);
}

public HelloSignException(String message, Integer httpCode, String type) {
this(message, httpCode, type, null);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hellosign/sdk/http/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public int asHttpCode() throws HelloSignException {
reset();
return code;
}
throw new HelloSignException("HTTP Code " + code);
throw new HelloSignException("HTTP Code " + code, code);
}

/**
Expand Down
10 changes: 8 additions & 2 deletions src/test/java/com/hellosign/sdk/HelloSignClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,16 @@ public void testCancelSignatureRequest() throws Exception {
assertTrue(client.cancelSignatureRequest("9cc3d5819959419abee4dbff2073d497e7c0a962"));
}

@Test(expected = HelloSignException.class)
@Test
public void testCancelSignatureRequestInvalid() throws Exception {
mockResponseCode(410);
client.cancelSignatureRequest("foo");
try {
client.cancelSignatureRequest("foo");
fail("Expected HelloSignException");
} catch (HelloSignException e) {
assertEquals("HTTP Code 410", e.getMessage());
assertEquals(410, (int) e.getHttpCode());
}
}

@Test
Expand Down