Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

How to get a proper error message?

Experimenter
Experimenter

Hello,

 

I am new to team center. I am trying to access error message by using the following code.

 

char* pc_error;
EMH_ask_error_text(iSts, &pc_error);
cout<<"Following Error Occoured :\n"<<pc_error<<endl;

 

But its return result like

The Form "%1$s" of type "%2$s" could not be deleted.

 

so how to get proper values for "%1$s" and "%2$s"

7 REPLIES 7

Re: How to get a proper error message?

Legend
Legend

try this statement

printf("Error : \"%d\",\"%s\"\n",ists,pc_error);

 

Re: How to get a proper error message?

Experimenter
Experimenter
Same output again
The Form "%1$s" of type "%2$s" could not be deleted.

Re: How to get a proper error message?

Legend
Legend

@anonymousstud wrote:
Same output again
The Form "%1$s" of type "%2$s" could not be deleted.

Then give your full block of code

The statement EMH_ask_error is correct, the bug located somewhere else in your code

Re: How to get a proper error message?

Experimenter
Experimenter

I am just trying to delete a form using AOM_delete()
iSts=AOM_delete(form);
then the above error occurs

Re: How to get a proper error message?

Legend
Legend

your error message means just that object you being deleted cannot be deleted.

May be this form have references to other objects or you haven't sufficient privileges to delete it.

Are you use BYPASS mode? (ITK_set_bypass(1))

 

Make sure there are no references to this forms otherwise delete references prior to delete form

Re: How to get a proper error message?

Legend
Legend

EMH_ask_error_text will give you the error message as it's defined in the EMH module. This text is not in the context of the current error or the object.

 

If you get an error while executing an ITK, then you need to use EMH_ask_errors to get all errors on the error stack. These are in the context of the current session/object. This ITK will give you error message with place holders (like %1$s) filled in.

---

Thanks and Regards

Yogesh Fegade

Re: How to get a proper error message?

Legend
Legend

Or alternatively, you could look in the syslog to see what the error was!

---

Thanks and Regards

Yogesh Fegade