chore: raise from specific exceptions
This commit is contained in:
parent
7c873edc19
commit
75bc72be6d
5 changed files with 6 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
from typing import Callable, Optional
|
||||
|
||||
from django.db import connection
|
||||
from django.db import DataError, connection
|
||||
|
||||
from ._version import parse_version
|
||||
|
||||
|
@ -53,7 +53,7 @@ def legacy_migration_factory(
|
|||
def inner(_apps, _schema_editor):
|
||||
current = get_schema_version()
|
||||
if current is None:
|
||||
raise Exception("current schema version was not found!")
|
||||
raise DataError("current schema version was not found!")
|
||||
|
||||
current_version = parse_version(current)
|
||||
if current_version >= target_version and not reverse:
|
||||
|
|
|
@ -21,7 +21,7 @@ VERSION_RE = re.compile(
|
|||
def parse_version(version: str):
|
||||
match = VERSION_RE.search(version)
|
||||
if not match:
|
||||
raise Exception(f"invalid version {version}")
|
||||
raise ValueError(f"invalid version {version}")
|
||||
|
||||
major, minor, patch = map(int, match.group("release").split("."))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue