decode method Null safety

XdrSCStatusType decode(
  1. XdrDataInputStream stream
)

Implementation

static XdrSCStatusType decode(XdrDataInputStream stream) {
  int value = stream.readInt();
  switch (value) {
    case 0:
      return SST_OK;
    case 1:
      return SST_UNKNOWN_ERROR;
    case 2:
      return SST_HOST_VALUE_ERROR;
    case 3:
      return SST_HOST_OBJECT_ERROR;
    case 4:
      return SST_HOST_FUNCTION_ERROR;
    case 5:
      return SST_HOST_STORAGE_ERROR;
    case 6:
      return SST_HOST_CONTEXT_ERROR;
    case 7:
      return SST_VM_ERROR;
    case 8:
      return SST_CONTRACT_ERROR;
    case 9:
      return SST_HOST_AUTH_ERROR;
    default:
      throw Exception("Unknown enum value: $value");
  }
}