Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class CanvasesCreateResponse implements SlackApiTextResponse {

private String canvasId;

private String detail;
private ResponseMetadata responseMetadata;

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class CanvasesEditResponse implements SlackApiTextResponse {
private String provided;
private transient Map<String, List<String>> httpResponseHeaders;

private String detail;
private ResponseMetadata responseMetadata;

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
import org.junit.Test;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

Expand Down Expand Up @@ -160,4 +162,34 @@ public void standalone_canvases_error() throws Exception {
);
assertThat(creation.getError(), is("invalid_arguments"));
}

@Test
public void error_detail() throws Exception {
MethodsClient client = slack.methods(botToken);
// canvases.create
{
CanvasesCreateResponse response = client.canvasesCreate(r -> r
.title("test")
.documentContent(CanvasDocumentContent.builder()
.markdown("test")
.type("invalid")
.build())
);
assertThat(response.isOk(), is(false));
assertThat(response.getError(), is("invalid_arguments"));
assertThat(response.getDetail(), is(notNullValue()));
}
// canvases.edit
{
CanvasesEditResponse response = client.canvasesEdit(r -> r
.canvasId("F123")
.changes(Collections.singletonList(CanvasDocumentChange.builder()
.documentContent(CanvasDocumentContent.builder().markdown("foo").type("invalid").build())
.build()))
);
assertThat(response.isOk(), is(false));
assertThat(response.getError(), is("invalid_arguments"));
assertThat(response.getDetail(), is(notNullValue()));
}
}
}
Loading