VMware {code} Community
yskp
Enthusiast
Enthusiast

Creating a custom fault for a custom task in an extension

We have a custom extension that allows us to successfully create custom tasks as well as update their description and progress.

However, I haven't been able to cause a custom task to fail with a fault. When I call SetTaskState(task, TaskInfoState.error, null, new LocalizedMethodFault { fault = new SomeFault() }), the task indeed fails but its status column shows Error rather than my own message.

I tried creating my own custom fault class and registering it. To do this, I used Extension.faultList:

faultResourceInfo.data = new List<KeyValue> { new KeyValue { key = "my.fault.myfault.summary", value = "Boo!"}}.ToArray();
ext.resourceList = new ExtensionResourceInfo[] { faultResourceInfo };
ext.faultList = new ExtensionFaultTypeInfo {new ExtensionFaultTypeInfo() {faultID = "my.fault.myfault"}};

I created a new myfault class, and re-generated the client code with a custom WSDL so that the serializer can serialize my class, but that did not work.

Thinking that I may be hitting some serialization issues, I tried using a standard VMware fault (e.g. ActiveDirectoryFault), and it did not work either.

I tried creating a LocalizedMethodFault with a non-null localizedMessage member, but still I could not get the task to fail with a custom error.

In all cases, examining the server's DB (VPX_TASK) table, shows a null ERROR_DATA for my task.

I found numerous example on creating custom tasks and updating their progress (e.g. communities.vmware.com/servlet/JiveServlet/previewBody/12616-102-1-13376/CreateCustomTask), but none show how to register custom faults.

Can someone point out how to do this? Do I have to associate the fault with my task somehow? Is there anything I'm missing here?

0 Kudos
2 Replies
vSeanTHereisNoW
Contributor
Contributor

yskp, were you ever able to get this to work. I am also seeing the same bahavior as you.

0 Kudos
yskp
Enthusiast
Enthusiast

Nope, sorry. Still stumped.

0 Kudos