An internal interface for adding an error code to the library. The returned code is suitable for returning to users.