|
| 1 | +using System.Net; |
| 2 | + |
| 3 | +namespace Firecrawl; |
| 4 | + |
| 5 | +/// <summary> |
| 6 | +/// Thrown for HTTP 401 Unauthorized responses (invalid or missing API key). |
| 7 | +/// </summary> |
| 8 | +[Serializable] |
| 9 | +public class FirecrawlAuthenticationException : ApiException |
| 10 | +{ |
| 11 | + public FirecrawlAuthenticationException() { } |
| 12 | + |
| 13 | + public FirecrawlAuthenticationException(string message) |
| 14 | + : base(message, HttpStatusCode.Unauthorized) { } |
| 15 | + |
| 16 | + public FirecrawlAuthenticationException(string message, Exception? innerException) |
| 17 | + : base(message, innerException, HttpStatusCode.Unauthorized) { } |
| 18 | +} |
| 19 | + |
| 20 | +/// <summary> |
| 21 | +/// Thrown for HTTP 429 Too Many Requests responses. |
| 22 | +/// </summary> |
| 23 | +[Serializable] |
| 24 | +public class FirecrawlRateLimitException : ApiException |
| 25 | +{ |
| 26 | + /// <summary> |
| 27 | + /// Value of the <c>Retry-After</c> response header, if present. |
| 28 | + /// Delta-seconds or HTTP-date depending on the server. |
| 29 | + /// </summary> |
| 30 | + public TimeSpan? RetryAfter { get; init; } |
| 31 | + |
| 32 | + public FirecrawlRateLimitException() { } |
| 33 | + |
| 34 | + public FirecrawlRateLimitException(string message) |
| 35 | + : base(message, HttpStatusCode.TooManyRequests) { } |
| 36 | + |
| 37 | + public FirecrawlRateLimitException(string message, Exception? innerException) |
| 38 | + : base(message, innerException, HttpStatusCode.TooManyRequests) { } |
| 39 | +} |
| 40 | + |
| 41 | +/// <summary> |
| 42 | +/// Thrown for HTTP 402 Payment Required responses (insufficient credits). |
| 43 | +/// </summary> |
| 44 | +[Serializable] |
| 45 | +public class FirecrawlPaymentRequiredException : ApiException |
| 46 | +{ |
| 47 | + public FirecrawlPaymentRequiredException() { } |
| 48 | + |
| 49 | + public FirecrawlPaymentRequiredException(string message) |
| 50 | + : base(message, HttpStatusCode.PaymentRequired) { } |
| 51 | + |
| 52 | + public FirecrawlPaymentRequiredException(string message, Exception? innerException) |
| 53 | + : base(message, innerException, HttpStatusCode.PaymentRequired) { } |
| 54 | +} |
| 55 | + |
| 56 | +/// <summary> |
| 57 | +/// Thrown for HTTP 5xx Server Error responses. |
| 58 | +/// </summary> |
| 59 | +[Serializable] |
| 60 | +public class FirecrawlServerException : ApiException |
| 61 | +{ |
| 62 | + public FirecrawlServerException() { } |
| 63 | + |
| 64 | + public FirecrawlServerException(string message, HttpStatusCode statusCode) |
| 65 | + : base(message, statusCode) { } |
| 66 | + |
| 67 | + public FirecrawlServerException(string message, Exception? innerException, HttpStatusCode statusCode) |
| 68 | + : base(message, innerException, statusCode) { } |
| 69 | +} |
0 commit comments