Skip to content

Commit

Permalink
Using NotFoundException when entity is not found conductor-oss#38
Browse files Browse the repository at this point in the history
  • Loading branch information
vamshiGML committed Feb 15, 2024
1 parent 58abdd5 commit 828bc5a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.Map;
import java.util.Optional;

import com.netflix.conductor.core.exception.NotFoundException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -108,7 +109,7 @@ public ResponseEntity<List<TaskExecLog>> getTaskLogs(@PathVariable("taskId") Str
return Optional.ofNullable(taskService.getTaskLogs(taskId))
.filter(logs -> !logs.isEmpty())
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
.orElseThrow(() -> new NotFoundException("Task logs not found for taskId: %s", taskId));
}

@GetMapping("/{taskId}")
Expand Down

0 comments on commit 828bc5a

Please sign in to comment.