-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
I encountered an issue where a certain mod file failed to upload, with SubmitNewModFileForMod() reporting an ErrorConditionTypes::InvalidArgsError. However, GetLastValidationError() returned an empty list, so I was not able to see the details of the problem.
Based on the SDK debug output I was able to determine that the same file can't be uploaded to multiple mods:
[10:46:10.3088638:308ms][Error][Http] Non 200-204 response received: {"error":{"code":422,"error_ref":13009,"message":"This file has already been uploaded to \"Untitled\". A file cannot be uploaded to multiple Levels."}}
It would be great to be able to determine this in code however, so that I can show corresponding feedback to the user.
My code looks basically like this:
void uploadFileForMod()
{
Modio::CreateModFileParams params;
params.RootDirectory = (mTempDirPath / "map").u8string();
Modio::SubmitNewModFileForMod(mNewModId, params);
}
void onModManagementEvent(const Modio::ModManagementEvent& ev)
{
if (ev.Event == Modio::ModManagementEvent::EventType::Uploaded)
{
if (!ev.Status)
{
mState = State::UploadedSuccessfully;
}
else
{
mState = State::UploadError;
if (ec == Modio::ErrorConditionTypes::InvalidArgsError)
{
LOG_F(ERROR, "SubmitNewModFileForMod() failed:");
const auto errors = Modio::GetLastValidationError(); // <---------------------- returns empty list
for (const auto& error : errors)
{
LOG_F(ERROR, "'%s': %s", error.Field.c_str(), error.Error.c_str());
}
}
else
{
LOG_F(ERROR, "SubmitNewModFileForMod() failed: %s", ec.message().c_str());
}
}
}
}Perhaps this is a user error on my part, but I didn't find anything in the documentation indicating that validation errors for SubmitNewModFileForMod need different handling than the usual approach.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels