Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -32,6 +32,9 @@ public class Task {
@SerializedName("result")
private Object result;

@SerializedName("error")
private TaskError error;

/**
* @return the id
*/
Expand Down Expand Up @@ -95,6 +98,13 @@ public Object getResult() {
return result;
}

/**
* @return the error
*/
public TaskError getError() {
return error;
}

public void setId(int id) {
this.id = id;
}
Expand Down Expand Up @@ -130,4 +140,8 @@ public void setProtocol(String protocol) {
public void setResult(Object result) {
this.result = result;
}

public void setError(TaskError error) {
this.error = error;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.constructor.client.models;

import com.google.gson.annotations.SerializedName;

/** Constructor.io Task Error... uses Gson/Reflection to load data in */
public class TaskError {

@SerializedName("message")
private String message;

/**
* @return the error message
*/
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ public void createTaskResponseWithQueuedTaskShouldReturnAResult() throws Excepti
assertNull(response.getResult());
}

@Test
public void createTaskResponseWithErrorTaskShouldReturnAResult() throws Exception {
String string = Utils.getTestResource("response.task.error.json");
Task response = ConstructorIO.createTaskResponse(string);

assertEquals("id exists", 100721281, response.getId());
assertEquals("status exists", "FAILED", response.getStatus());
assertEquals(
"Error message exists",
"IngestionError: The items file you have uploaded is empty. Please fix it and try"
+ " again.",
response.getError().getMessage());
}

@Test
public void createTaskResponseWithDoneTaskShouldReturnAResult() throws Exception {
String string = Utils.getTestResource("response.task.done.json");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"id": 100721281,
"status": "FAILED",
"submission_time": "2024-08-21T18:11:49",
"last_update": "2024-08-21T18:11:53",
"start_time": "2024-08-21T18:11:51",
"type": "ingestion",
"error": {
"message": "IngestionError: The items file you have uploaded is empty. Please fix it and try again."
},
"filename": "filename",
"protocol": "http",
"ingestion_type": "patchdelta"
}
Loading