This repository has been archived on 2023-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
hamakaze/Hamakaze/HttpException.cs

74 lines
3.6 KiB
C#
Raw Normal View History

2022-04-06 09:25:49 +00:00
using System;
namespace Hamakaze {
public class HttpException : Exception {
public HttpException(string message) : base(message) { }
}
2022-04-09 22:34:05 +00:00
public class HttpUpgradeException : HttpException {
public HttpUpgradeException(string message) : base(message) { }
}
public class HttpUpgradeProtocolVersionException : HttpUpgradeException {
public HttpUpgradeProtocolVersionException(string expectedVersion, string givenVersion)
: base($@"Server HTTP version ({givenVersion}) is lower than what is expected {expectedVersion}.") { }
}
public class HttpUpgradeUnexpectedStatusException : HttpUpgradeException {
public HttpUpgradeUnexpectedStatusException(int statusCode) : base($@"Expected HTTP status code 101, got {statusCode}.") { }
}
public class HttpUpgradeUnexpectedHeaderException : HttpUpgradeException {
public HttpUpgradeUnexpectedHeaderException(string header, string expected, string given)
: base($@"Unexpected {header} header value ""{given}"", expected ""{expected}"".") { }
}
public class HttpUpgradeInvalidHashException : HttpUpgradeException {
public HttpUpgradeInvalidHashException(string expected, string given)
: base($@"Server sent invalid hash ""{given}"", expected ""{expected}"".") { }
}
public class HttpConnectionException : HttpException {
public HttpConnectionException(string message) : base(message) { }
}
public class HttpConnectionAlreadyUpgradedException : HttpConnectionException {
public HttpConnectionAlreadyUpgradedException() : base(@"This connection has already been upgraded.") { }
}
2022-04-06 09:25:49 +00:00
public class HttpConnectionManagerException : HttpException {
public HttpConnectionManagerException(string message) : base(message) { }
}
public class HttpConnectionManagerLockException : HttpConnectionManagerException {
public HttpConnectionManagerLockException() : base(@"Failed to lock the connection manager in time.") { }
}
2022-04-07 18:59:52 +00:00
public class HttpRequestMessageException : HttpException {
public HttpRequestMessageException(string message) : base(message) { }
}
public class HttpRequestMessageStreamException : HttpRequestMessageException {
public HttpRequestMessageStreamException() : base(@"Provided Stream is not writable.") { }
}
2022-04-06 09:25:49 +00:00
public class HttpTaskException : HttpException {
public HttpTaskException(string message) : base(message) { }
}
public class HttpTaskAlreadyStartedException : HttpTaskException {
public HttpTaskAlreadyStartedException() : base(@"Task has already started.") { }
}
public class HttpTaskInvalidStateException : HttpTaskException {
public HttpTaskInvalidStateException() : base(@"Task has ended up in an invalid state.") { }
}
public class HttpTaskNoAddressesException : HttpTaskException {
public HttpTaskNoAddressesException() : base(@"Could not find any addresses for this host.") { }
}
public class HttpTaskNoConnectionException : HttpTaskException {
public HttpTaskNoConnectionException() : base(@"Was unable to create a connection with this host.") { }
}
public class HttpTaskRequestFailedException : HttpTaskException {
public HttpTaskRequestFailedException() : base(@"Request failed for unknown reasons.") { }
}
public class HttpTaskManagerException : HttpException {
public HttpTaskManagerException(string message) : base(message) { }
}
public class HttpTaskManagerLockException : HttpTaskManagerException {
public HttpTaskManagerLockException() : base(@"Failed to reserve a thread.") { }
}
}