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
3 changes: 3 additions & 0 deletions backend/src/services/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ export class FileService implements OnModuleInit {
.take(take)
.skip(skip)
.getManyAndCount();
if (files.length === 0) {
throw new Error('No files found.');
}

return {
data: files.map((element) => fileEntityToDto(element)),
Expand Down
9 changes: 8 additions & 1 deletion cli/kleinkram/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from typing import Sequence
from uuid import UUID

import httpx
from rich.console import Console
from tqdm import tqdm

Expand All @@ -33,6 +34,7 @@
from kleinkram.api.query import MissionQuery
from kleinkram.api.query import ProjectQuery
from kleinkram.api.query import check_mission_query_is_creatable
from kleinkram.errors import InvalidFileQuery
from kleinkram.errors import MissionNotFound
from kleinkram.models import FileState
from kleinkram.models import FileVerificationStatus
Expand Down Expand Up @@ -67,7 +69,12 @@ def download(
raise ValueError(f"Destination {base_dir.absolute()} is not a directory")

# retrive files and get the destination paths
files = list(kleinkram.api.routes.get_files(client, file_query=query))
try:
files = list(kleinkram.api.routes.get_files(client, file_query=query))
except httpx.HTTPStatusError:
raise InvalidFileQuery(
f"Files not found. Maybe you forgot to specify mission or project flags: {query}"
)
paths = file_paths_from_files(files, dest=base_dir, allow_nested=nested)

if verbose:
Expand Down
Loading