Properly marshall diagnostic codes to the managed layer