realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Align PrimaryKey related exceptions

Open zaki50 opened this issue 8 years ago • 1 comments

When createObject(Class,Object) is called and the Class does not have any primary key, it throws IllegalStateException. On the other hand, if createObject(Class) is called and the Class has a primary key, it throws RealmException.

Typed RealmObject throws RealmException but DynamicRealmObject throws IllegalArgumentException when setter is called a against primary key.

Shouldn’t we align the exception about primary key?

zaki50 avatar Sep 14 '16 08:09 zaki50

Current conclusion of our internal discussion is that we will align them to RealmException.

zaki50 avatar Sep 14 '16 09:09 zaki50