Skip to content
Merged
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,10 +22,10 @@
import org.junit.Test;

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

import static org.hamcrest.CoreMatchers.is;
Comment thread
Lexer11l marked this conversation as resolved.
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;

@Slf4j
Expand Down Expand Up @@ -160,4 +160,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