Skip to content

Commit

Permalink
refactor: rename SubmissionClosed to SubmissionClosedException
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem committed Feb 8, 2024
1 parent 730bea6 commit 1aed662
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
namespace ArmoniK.Core.Common.Exceptions;

[Serializable]
public class SubmissionClosed : ArmoniKException
public class SubmissionClosedException : ArmoniKException
{
public SubmissionClosed()
public SubmissionClosedException()
{
}

public SubmissionClosed(string message)
public SubmissionClosedException(string message)
: base(message)
{
}

public SubmissionClosed(string message,
Exception innerException)
public SubmissionClosedException(string message,
Exception innerException)
: base(message,
innerException)
{
Expand Down
4 changes: 2 additions & 2 deletions Common/src/Storage/TaskLifeCycleHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ public static TaskOptions ValidateSession(SessionData sessionData,
// we are on client side
if (sessionData.SessionId == parentTaskId && !sessionData.ClientSubmission)
{
throw new SubmissionClosed("Client submission is closed");
throw new SubmissionClosedException("Client submission is closed");
}

// we are on worker side
if (sessionData.SessionId != parentTaskId && !sessionData.WorkerSubmission)
{
throw new SubmissionClosed("Worker submission is closed");
throw new SubmissionClosedException("Worker submission is closed");
}

return localOptions;
Expand Down
2 changes: 1 addition & 1 deletion Common/src/gRPC/Services/GrpcTasksService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ await TaskLifeCycleHelper.FinalizeTaskCreation(taskTable_,
},
};
}
catch (SubmissionClosed e)
catch (SubmissionClosedException e)
{
logger_.LogWarning(e,
"Error while submitting tasks");
Expand Down
22 changes: 11 additions & 11 deletions Common/tests/Pollster/AgentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -706,17 +706,17 @@ await holder.SessionTable.StopSubmissionAsync(holder.Session,
holder.Token,
NullLogger.Instance);

Assert.ThrowsAsync<SubmissionClosed>(() => agent.SubmitTasks(new TaskSubmissionRequest[]
{
new("payload",
null,
new List<string>(),
new List<string>()),
},
null,
holder.Session,
holder.Token,
CancellationToken.None));
Assert.ThrowsAsync<SubmissionClosedException>(() => agent.SubmitTasks(new TaskSubmissionRequest[]
{
new("payload",
null,
new List<string>(),
new List<string>()),
},
null,
holder.Session,
holder.Token,
CancellationToken.None));
}

[Test]
Expand Down

0 comments on commit 1aed662

Please sign in to comment.