Page MenuHome

Update USD Error Handling
Needs ReviewPublic

Authored by superfunc on Dec 20 2019, 5:45 AM.

Details

Summary

As listed in https://developer.blender.org/T72204, and its aforementioned issue, this is a small patch to catch a more comprehensive set of errors that may be emitted in the process of constructing a USD stage.


Note: This work is done solely in a personal capacity and is not endorsed by any of my current or previous employers.

Diff Detail

Event Timeline

superfunc created this revision.Dec 20 2019, 5:45 AM

I'm not really impressed with the errors produced by the USD library. When it cannot find the plugin JSON files, this just shows "USD Export: internal issue (Failed verification: ' fileFormat ')" in the GUI, which won't mean anything to artists.

The error code string for this error is "TF_DIAGNOSTIC_CODING_ERROR_TYPE", which also doesn't help if we want to translate the error message to something that is more user-friendly. @superfunc do you know whether the other error cases have a more specific identifier?

Subsequent WM_reportf() overwrite the message in the status bar, so in effect this will show only the last message to the user (unless they have the Info editor open, which isn't open by default). Probably it's better to just printf() the low-level USD error, and keep original message in place unless we can extract something more explanatory.

I'm not really impressed with the errors produced by the USD library. When it cannot find the plugin JSON files, this just shows "USD Export: internal issue (Failed verification: ' fileFormat ')" in the GUI, which won't mean anything to artists.

This is a really good point. Sorry, I was thinking a bit too technical forgetting the audience of this.

The error code string for this error is "TF_DIAGNOSTIC_CODING_ERROR_TYPE", which also doesn't help if we want to translate the error message to something that is more user-friendly. @superfunc do you know whether the other error cases have a more specific identifier?

Let me look into something nicer we can surface for this.

Subsequent WM_reportf() overwrite the message in the status bar, so in effect this will show only the last message to the user (unless they have the Info editor open, which isn't open by default). Probably it's better to just printf() the low-level USD error, and keep original message in place unless we can extract something more explanatory.

Agreed for this.

@Sybren A. Stüvel (sybren) Sorry again for the hastiness of that first change. I think a better approach here is to handle these known cases explicitly to craft
nicer error messages for the user. In general a lot of the USD error reporting is a bit opaque from an artists perspective.

I am submitting a new diff that handles a couple cases.

  1. layer identifier clashes
  1. missing plugin files (sample screenshot below)

Beyond those, we relay that its an unknown issue and we log to the console as suggested, rather than the user facing area.

superfunc updated this revision to Diff 20469.Dec 23 2019, 1:36 AM

Described in most recent comment (sorry still getting used to phabricator).

source/blender/usd/intern/usd_capi.cc
95–117

I'm not really a fan of copying the functionality of the USD library. USD itself is already doing these checks; this code only works because it's doing the same thing USD is already doing. This makes it intrinsincly fragile, as USD is going to be updated at some point.

Isn't there a way to improve USD so that it returns a unique code Blender can map to a nicer error message? Or let the USD library itself produce nicer error messages that are actually useful to an end user?