Fix EZP-23255: Show correct error on createObject

Closes #1056