Yes, an exception is likely to be the most appropriate way to handle the error here - at least it will be the cleanest way. It also means that the “new” operator will fail.
If your application is no exception, then you have a problem. In this case, the factory method in the class may make sense.
static A * create() { ... }
, , null, .