Files
pgsql-jellyfin/src/Jellyfin.Database/Jellyfin.Database.Providers.Postgres/Exceptions/PostgresVersionMismatchException.cs
T
wjones 667c3768a9 Enhanced logging & error handling for auth and pg backups
- Add detailed debug/warning logs to authentication flows (AuthService, AuthorizationContext, WebSocketManager) for better traceability of auth attempts and failures.
- Log WebSocket authentication attempts, including IP, path, and token preview.
- Introduce PostgresVersionMismatchException for pg_dump/pg_restore version mismatches; parse and log server/client versions, clean up failed backups, and provide upgrade guidance.
- Add helper for parsing version mismatch errors.
- Update using directives and minor code cleanups.
- Update .csproj.user with new publish profile path.
2026-03-04 12:37:39 -05:00

56 lines
2.2 KiB
C#

// <copyright file="PostgresVersionMismatchException.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace Jellyfin.Database.Providers.Postgres.Exceptions;
using System;
/// <summary>
/// Exception thrown when there is a version mismatch between PostgreSQL server and client tools (pg_dump/pg_restore).
/// </summary>
public class PostgresVersionMismatchException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="PostgresVersionMismatchException"/> class.
/// </summary>
/// <param name="serverVersion">The PostgreSQL server version.</param>
/// <param name="clientVersion">The pg_dump/pg_restore client version.</param>
public PostgresVersionMismatchException(string serverVersion, string clientVersion)
: base(BuildMessage(serverVersion, clientVersion))
{
ServerVersion = serverVersion;
ClientVersion = clientVersion;
}
/// <summary>
/// Initializes a new instance of the <see cref="PostgresVersionMismatchException"/> class.
/// </summary>
/// <param name="serverVersion">The PostgreSQL server version.</param>
/// <param name="clientVersion">The pg_dump/pg_restore client version.</param>
/// <param name="innerException">The inner exception.</param>
public PostgresVersionMismatchException(string serverVersion, string clientVersion, Exception innerException)
: base(BuildMessage(serverVersion, clientVersion), innerException)
{
ServerVersion = serverVersion;
ClientVersion = clientVersion;
}
/// <summary>
/// Gets the PostgreSQL server version.
/// </summary>
public string ServerVersion { get; }
/// <summary>
/// Gets the pg_dump/pg_restore client version.
/// </summary>
public string ClientVersion { get; }
private static string BuildMessage(string serverVersion, string clientVersion)
{
return $"PostgreSQL server version ({serverVersion}) does not match pg_dump version ({clientVersion}). " +
"Please upgrade your PostgreSQL client tools to match or exceed the server version. " +
"You can specify a custom path to pg_dump in the database backup options configuration.";
}
}