#primitiveFailFor: can be used to signal a primitive failure with an integer error code. The VM can map a small set of these codes to symbols like #'bad argument' that can be checked for in <primitive:...error:> methods.
How should a module primitive use #primitiveFailFor: with its own custom error codes, so that they don't collide with the VM's current and future set of PrimErr* codes? This RSqueak issue says to use negative integers for application-specific errors:
https://github.com/HPI-SWA-Lab/RSqueak/issues/130Is that preferred for modules?