Reasons why ApCreateModule may fail

Does anyone have the knowledge of the specific reasons why the ApCreateModule call may return NULL on occasion? It seems that 99.99% of the time, the same code works with no issues at all.

The Photon Library Reference documentation states for ApCreateModule,

I am looking for specifics on “NULL if an error occurred.”

Thanks in advance for any information.

If the return value is NULL, what does
strerror( errno );
say?

Does strerror(errno) actually return the error for the failure of ApCreateModule?

Since the failure of ApCreateModule occurs so rarely, I am not sure how to reproduce the error to be able to use strerror in order to determine the error code.

Hope I understood your post.

why not use a if-statement for deciding if it was NULL and then put sterror(errno)