# How to handle errors when using the A3DAsmModelFileLoadFromFile function in C++

**URL:** https://forum.techsoft3d.com/t/how-to-handle-errors-when-using-the-a3dasmmodelfileloadfromfile-function-in-c/3516
**Category:** HOOPS Exchange
**Created:** [April 5, 2024, 8:31am UTC](https://forum.techsoft3d.com/t/how-to-handle-errors-when-using-the-a3dasmmodelfileloadfromfile-function-in-c/3516 "2024-04-05T08:31:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mini](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@mini](https://forum.techsoft3d.com/u/mini)
#### Post date: [April 5, 2024, 8:31am UTC](https://forum.techsoft3d.com/t/how-to-handle-errors-when-using-the-a3dasmmodelfileloadfromfile-function-in-c/3516/1 "2024-04-05T08:31:05Z")

</div>

When importing a CAD Data File using the A3DAsmModelFileLoadFromFile function, when reading an incorrect or damaged Data File, a problem occurs in the Progam we are developing and the entire program crashes. I am curious about how to prevent this.

I’ve currently tried using C++ Try Catch to handle this issue, but it doesn’t seem to solve the problem.

We are processing it as follows:

**A3DAsmModelFile \* pcAsmModelFile = nullptr;**  
**A3DStatus eStatus = A3D\_ERROR;**  
**eStatus = A3DAsmModelFileLoadFromFile(pchUtf8Path, &cParamsLoadData, &pcAsmModelFile);**  
**delete [] pchUtf8Path;**

The callback function was also set up.

A3DStatus nStatus = A3DDllSetCallbacksReport(CallbackReportMessage, CallbackReportWarning, CallbackReportError);  
if(A3D\_SUCCESS == nStatus) {  
return true;  
}

Currently, I am having trouble because the program terminates when the wrong CAD file is read. I would appreciate it if you could tell me how to solve this problem.

Or, it would be better if there was a way to check for incorrect CAD files in advance.

I would appreciate it if you could give me some good ideas.
