It's a System.NoAccessException
. The message is:
No access to entity: MyObject__c
Not sure the easiest way to verify, but I set up a Visualforce Page with the below controller so the running user didn't need appropriate permissions to execute anonymous Apex.
public with sharing class Demo
{
public String type { get; private set; }
public String message { get; private set; }
public Demo()
{
try
{
Security.stripInaccessible(AccessType.CREATABLE, new List<NoPerm__c> {
new NoPerm__c()
});
}
catch (Exception e)
{
message = e.getMessage();
type = e.getTypeName();
}
}
}
And the markup was simply:
<apex:page controller="Demo">
<apex:pageMessage severity="FATAL"
summary="{!type}"
detail="{!message}" />
</apex:page>