From 3a855bcae3104075b75433cc29f9b00a09644ca0 Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Wed, 18 Oct 2023 16:51:18 -0700 Subject: [PATCH] Make 'reference to a non-existent schema item ' an ISE It is always a bug. --- edb/schema/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/edb/schema/schema.py b/edb/schema/schema.py index 4d1c3d8fb69..64aeeb12872 100644 --- a/edb/schema/schema.py +++ b/edb/schema/schema.py @@ -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 @@ -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}'