Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions core/synchronizationerror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ SynchronizationError::SynchronizationError() = default;

SynchronizationError::ErrorType SynchronizationError::errorType( const int httpErrorCode, const QString &errorMessage, const QString &serverErrorCode )
{
//prioritise serverErrorCode parsing before httpErrorCode deduction
if ( serverErrorCode == QStringLiteral( "ProjectsLimitHit" ) )
{
return ErrorType::ProjectLimitHit;
}
if ( serverErrorCode == QStringLiteral( "StorageLimitHit" ) )
{
return ErrorType::StorageLimitHit;
}
if ( serverErrorCode == QStringLiteral( "ProjectVersionExists" ) )
{
return ErrorType::VersionMismatch;
}
if ( serverErrorCode == QStringLiteral( "AnotherUploadRunning" ) )
{
return ErrorType::AnotherProcessIsRunning;
}

if ( httpErrorCode == 400 )
{
// 'Another process is running. Please try later.'
Expand All @@ -37,26 +55,6 @@ SynchronizationError::ErrorType SynchronizationError::errorType( const int httpE
// Project no longer exists / is on different server
return ErrorType::ProjectNotFound;
}
else if ( httpErrorCode == 409 )
{
//choose depending on serverErrorCode
if ( serverErrorCode == QStringLiteral( "ProjectsLimitHit" ) )
{
return ErrorType::ProjectLimitHit;
}
if ( serverErrorCode == QStringLiteral( "StorageLimitHit" ) )
{
return ErrorType::StorageLimitHit;
}
if ( serverErrorCode == QStringLiteral( "ProjectVersionExists" ) )
{
return ErrorType::VersionMismatch;
}
if ( serverErrorCode == QStringLiteral( "AnotherUploadRunning" ) )
{
return ErrorType::AnotherProcessIsRunning;
}
}
else if ( httpErrorCode == 429 || httpErrorCode >= 500 )
{
// Exceptions in server code or maintenance mode
Expand Down
Loading