mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-03 21:36:15 +01:00
Report class name when reporting an error during instantiating BaseModel object
This commit is contained in:
parent
b4a1b29f57
commit
ea0bf1bb60
@ -321,12 +321,12 @@ class BaseModel(metaclass=ModelMeta):
|
||||
|
||||
if kwargs:
|
||||
unknown_fields_str = ", ".join([f"'{i}'" for i in kwargs])
|
||||
raise TypeError(f"The following kwargs do not match any field: {unknown_fields_str}")
|
||||
raise TypeError(f"The following kwargs of '{self.__class__.__name__}.__init__()' do not match any field: {unknown_fields_str}")
|
||||
|
||||
if uninitialized_fields:
|
||||
uninitialized_fields_str = ", ".join([f"'{i}'" for i in uninitialized_fields])
|
||||
raise TypeError(
|
||||
f"The following fields are not initialized and have no default either: {uninitialized_fields_str}"
|
||||
f"The following fields of '{self.__class__.__name__}' object are not initialized and have no default either: {uninitialized_fields_str}"
|
||||
)
|
||||
|
||||
for name, field in self.__fields__.items():
|
||||
|
Loading…
Reference in New Issue
Block a user