Function physfs_sys::PHYSFS_setErrorCode[][src]

pub unsafe extern "C" fn PHYSFS_setErrorCode(code: PHYSFS_ErrorCode)
Expand description

\fn void PHYSFS_setErrorCode(PHYSFS_ErrorCode code) \brief Set the current thread’s error code.

This lets you set the value that will be returned by the next call to PHYSFS_getLastErrorCode(). This will replace any existing error code, whether set by your application or internally by PhysicsFS.

Error codes are stored per-thread; what you set here will not be accessible to another thread.

Any call into PhysicsFS may change the current error code, so any code you set here is somewhat fragile, and thus you shouldn’t build any serious error reporting framework on this function. The primary goal of this function is to allow PHYSFS_Io implementations to set the error state, which generally will be passed back to your application when PhysicsFS makes a PHYSFS_Io call that fails internally.

This function doesn’t care if the error code is a value known to PhysicsFS or not (but PHYSFS_getErrorByCode() will return NULL for unknown values). The value will be reported unmolested by PHYSFS_getLastErrorCode().

\param code Error code to become the current thread’s new error state.

\sa PHYSFS_getLastErrorCode \sa PHYSFS_getErrorByCode