Serve 503 when PocketBase is unavailable across all content pages

This commit is contained in:
tleininger committed 2026-09-24 13:00:14 +02:00
1 parent 0f7e968c16
commit e242eaf79a
25 files changed
+492 -253

No files matched your search

@@ -0,0 +1,49 @@
namespace Elternbeirat.PocketBase;
/// <summary>
/// Thrown when PocketBase could not be reached, timed out, or returned a
/// response that could not be read.
/// </summary>
/// <remarks>
/// This is the one failure the content pages need to distinguish: the site is
/// up but its data store is not, which is an HTTP 503, not a 404. Which
/// low-level exceptions mean that (a transport error, a timeout, unreadable
/// JSON) is <see cref="PocketBaseClient"/>'s concern; callers catch only this
/// type and need not know how the client talks to PocketBase.
/// </remarks>
public sealed class PocketBaseUnavailableException : Exception
{
/// <summary>
/// Initializes a new instance with a default message.
/// </summary>
public PocketBaseUnavailableException()
: base("PocketBase is unavailable.")
{
}
/// <summary>
/// Initializes a new instance with the given message.
/// </summary>
/// <param name="message">
/// The message that describes the error.
/// </param>
public PocketBaseUnavailableException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance with the given message and the underlying
/// failure that caused it.
/// </summary>
/// <param name="message">
/// The message that describes the error.
/// </param>
/// <param name="innerException">
/// The transport, timeout, or deserialization exception that was caught.
/// </param>
public PocketBaseUnavailableException(string message, Exception innerException)
: base(message, innerException)
{
}
}