Catch transform errors
parent
3f6a31f2b5
commit
6d99ad01d7
|
@ -178,6 +178,7 @@ class ApiController extends Controller {
|
|||
}
|
||||
|
||||
// Run actual query
|
||||
try {
|
||||
$list = $this->timelineQuery->getDays(
|
||||
$folder,
|
||||
$uid,
|
||||
|
@ -195,6 +196,9 @@ class ApiController extends Controller {
|
|||
}
|
||||
|
||||
return new JSONResponse($list, Http::STATUS_OK);
|
||||
} catch (\Exception $e) {
|
||||
return new JSONResponse(["message" => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,6 +251,7 @@ class ApiController extends Controller {
|
|||
}
|
||||
|
||||
// Run actual query
|
||||
try {
|
||||
$list = $this->timelineQuery->getDay(
|
||||
$folder,
|
||||
$uid,
|
||||
|
@ -256,6 +261,9 @@ class ApiController extends Controller {
|
|||
$this->getTransformations(),
|
||||
);
|
||||
return new JSONResponse($list, Http::STATUS_OK);
|
||||
} catch (\Exception $e) {
|
||||
return new JSONResponse(["message" => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,10 +10,10 @@ use OCP\Files\Folder;
|
|||
trait TimelineQueryFaces {
|
||||
protected IDBConnection $connection;
|
||||
|
||||
public function transformFaceFilter(IQueryBuilder &$query, string $userId, string $faceName) {
|
||||
public function transformFaceFilter(IQueryBuilder &$query, string $userId, string $faceStr) {
|
||||
// Get title and uid of face user
|
||||
$faceNames = explode('/', $faceName);
|
||||
if (count($faceNames) !== 2) return;
|
||||
$faceNames = explode('/', $faceStr);
|
||||
if (count($faceNames) !== 2) throw new \Exception("Invalid face query");
|
||||
$faceUid = $faceNames[0];
|
||||
$faceName = $faceNames[1];
|
||||
|
||||
|
@ -23,7 +23,7 @@ trait TimelineQueryFaces {
|
|||
->where($query->expr()->eq('user_id', $sq->createNamedParameter($faceUid)))
|
||||
->andWhere($query->expr()->eq('title', $sq->createNamedParameter($faceName)))
|
||||
->executeQuery()->fetchOne();
|
||||
if (!$id) return;
|
||||
if (!$id) throw new \Exception("Unknown person: $faceStr");
|
||||
|
||||
// Join with cluster
|
||||
$query->innerJoin('m', 'recognize_face_detections', 'rfd', $query->expr()->andX(
|
||||
|
|
|
@ -22,7 +22,7 @@ trait TimelineQueryTags {
|
|||
public function transformTagFilter(IQueryBuilder &$query, string $userId, string $tagName) {
|
||||
$tagId = $this->getSystemTagId($query, $tagName);
|
||||
if ($tagId === FALSE) {
|
||||
$tagId = 0; // cannot abort here; that will show up everything in the response
|
||||
throw new \Exception("Tag $tagName not found");
|
||||
}
|
||||
|
||||
$query->innerJoin('m', 'systemtag_object_mapping', 'stom', $query->expr()->andX(
|
||||
|
|
Loading…
Reference in New Issue