Skip to content

Commit

Permalink
Make 'reference to a non-existent schema item <id>' an ISE (#6314)
Browse files Browse the repository at this point in the history
It is always a bug.
  • Loading branch information
msullivan authored and aljazerzen committed Oct 20, 2023
1 parent 8b1727a commit 538b0d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions edb/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ def _get_by_id(
sclass_name = self._id_to_type[obj_id]
except KeyError:
if default is so.NoDefault:
raise errors.InvalidReferenceError(
raise LookupError(
f'reference to a non-existent schema item {obj_id}'
f' in schema {self!r}'
) from None
Expand All @@ -1322,7 +1322,7 @@ def _get_by_id(
else:
obj = so.Object.schema_restore((sclass_name, obj_id))
if type is not None and not isinstance(obj, type):
raise errors.InvalidReferenceError(
raise TypeError(
f'schema object {obj_id!r} exists, but is a '
f'{obj.__class__.get_schema_class_displayname()!r}, '
f'not a {type.get_schema_class_displayname()!r}'
Expand Down

0 comments on commit 538b0d0

Please sign in to comment.