-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
176 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
|
||
namespace HADotNet.Core.Domain | ||
{ | ||
/// <summary> | ||
/// Represents a failed HTTP call to a Home Assistant endpoint. | ||
/// </summary> | ||
public class HttpResponseException : Exception | ||
{ | ||
/// <summary> | ||
/// Gets the status code for the HTTP response. | ||
/// </summary> | ||
public int StatusCode { get; } | ||
|
||
/// <summary> | ||
/// Gets the network description, if the error was at the network level. | ||
/// </summary> | ||
public string NetworkDescription { get; } | ||
|
||
/// <summary> | ||
/// Gets the original request path. | ||
/// </summary> | ||
public string RequestPath { get; } | ||
|
||
/// <summary> | ||
/// Gets the error response body. | ||
/// </summary> | ||
public string ResponseBody { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new HttpResponseException. | ||
/// </summary> | ||
public HttpResponseException(int statusCode, string networkDescription, string requestPath, string responseBody) | ||
{ | ||
StatusCode = statusCode; | ||
NetworkDescription = networkDescription; | ||
RequestPath = requestPath; | ||
ResponseBody = responseBody; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new HttpResponseException. | ||
/// </summary> | ||
public HttpResponseException(int statusCode, string networkDescription, string requestPath, string responseBody, string message) : base(message) | ||
{ | ||
StatusCode = statusCode; | ||
NetworkDescription = networkDescription; | ||
RequestPath = requestPath; | ||
ResponseBody = responseBody; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new HttpResponseException. | ||
/// </summary> | ||
public HttpResponseException(int statusCode, string networkDescription, string requestPath, string responseBody, string message, Exception innerException) : base(message, innerException) | ||
{ | ||
StatusCode = statusCode; | ||
NetworkDescription = networkDescription; | ||
RequestPath = requestPath; | ||
ResponseBody = responseBody; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
|
||
namespace HADotNet.Core.Domain | ||
{ | ||
/// <summary> | ||
/// The exception that occurs when a Supervisor-only API call is made to a non-Supervisor environment. | ||
/// </summary> | ||
public class SupervisorNotFoundException : Exception | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the SupervisorNotFoundException. | ||
/// </summary> | ||
public SupervisorNotFoundException() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the SupervisorNotFoundException. | ||
/// </summary> | ||
public SupervisorNotFoundException(string message) : base(message) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the SupervisorNotFoundException. | ||
/// </summary> | ||
public SupervisorNotFoundException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters