from sqlite3 import Row
from datetime import datetime
from plomtask.db import DatabaseConnection
-from plomtask.misc import HandledException
+from plomtask.exceptions import NotFoundException, BadFormatException
class Process:
"""Template for, and metadata for, Todos, and their arrangements."""
def __init__(self, id_: int | None) -> None:
- self.id_ = id_ if id_ != 0 else None # to avoid DB-confusing rowid=0
+ if (id_ is not None) and id_ < 1:
+ raise BadFormatException(f'illegal Process ID, must be >=1: {id_}')
+ self.id_ = id_
self.title = VersionedAttribute(self, 'title', 'UNNAMED')
self.description = VersionedAttribute(self, 'description', '')
self.effort = VersionedAttribute(self, 'effort', 1.0)
break
if not process:
if not create:
- raise HandledException(f'Process not found of id: {id_}')
+ raise NotFoundException(f'Process not found of id: {id_}')
process = Process(id_)
if process:
for row in db_conn.exec('SELECT * FROM process_titles '