Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Refactor; rename exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad committed Jul 20, 2021
1 parent 987cbc5 commit fe84c72
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions Communication/DaemonCommander.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static bool GetPullSecret()
{
ae.Handle((x) =>
{
if (x is NotFoundException) // This we know how to handle.
if (x is APINotFoundException) // This we know how to handle.
{
// Marking as handled
return true;
Expand Down Expand Up @@ -140,12 +140,12 @@ private static async Task<string> postResponse(string cmd, string content, int t
case HttpStatusCode.InternalServerError:
throw new APIException(body);
case HttpStatusCode.NotFound:
throw new NotFoundException(body);
throw new APINotFoundException(body);
}
}
catch (TimeoutException e)
{
throw new CommunicationException(e.Message);
throw new APICommunicationException(e.Message);
}
catch (Exception e)
{
Expand Down Expand Up @@ -174,12 +174,12 @@ private static async Task<string> getResponse(string cmd, int timeout)
case HttpStatusCode.InternalServerError:
throw new APIException(body);
case HttpStatusCode.NotFound:
throw new NotFoundException(body);
throw new APINotFoundException(body);
}
}
catch (TimeoutException e)
{
throw new CommunicationException(e.Message);
throw new APICommunicationException(e.Message);
}
catch (Exception e)
{
Expand Down
12 changes: 6 additions & 6 deletions Communication/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace CRCTray.Communication
{
internal class NotFoundException : Exception
internal class APIException : Exception
{
public NotFoundException(string message) : base(message) { }
public APIException(string message) : base(message) { }

}

internal class APIException : Exception
internal class APINotFoundException : Exception
{
public APIException(string message) : base(message) { }
public APINotFoundException(string message) : base(message) { }

}

internal class CommunicationException : Exception
internal class APICommunicationException : Exception
{
public CommunicationException(string message) : base(message) { }
public APICommunicationException(string message) : base(message) { }

}

Expand Down
4 changes: 2 additions & 2 deletions Helpers/TaskHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static async Task<T> TryTaskAndNotify<T>(Func<T> function, string success
{
ae.Handle((x) =>
{
if (x is CommunicationException) // This we know how to handle.
if (x is APICommunicationException) // This we know how to handle.
{
// TODO: start counting and eventually notify

Expand Down Expand Up @@ -73,7 +73,7 @@ public static async Task<T> TryTaskAndNotify<T, TArgs>(Func<TArgs, T> function,
{
ae.Handle((x) =>
{
if (x is CommunicationException) // This we know how to handle.
if (x is APICommunicationException) // This we know how to handle.
{
// TODO: start counting and eventually notify

Expand Down

0 comments on commit fe84c72

Please sign in to comment.