26 lines
908 B
C#
26 lines
908 B
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using LaDOSE.Business.Interface;
|
|
using LaDOSE.Entity;
|
|
|
|
namespace LaDOSE.Business.Provider.SheetsProvider
|
|
{
|
|
/// <summary>
|
|
/// The default when GoogleSheets:Writer names nothing usable. Reports itself as
|
|
/// unconfigured so the API answers 503 with a message the user can act on, rather than
|
|
/// throwing a NullReferenceException that reaches the browser as an HTML developer page.
|
|
/// </summary>
|
|
public class DisabledSheetsWriter : ISheetsWriter
|
|
{
|
|
public string Name => "Disabled";
|
|
|
|
public bool IsConfigured => false;
|
|
|
|
public Task<SheetExportResult> WriteTablesAsync(SheetExportRequest request, CancellationToken ct = default)
|
|
{
|
|
throw new SheetsExportException(503,
|
|
"Google Sheets export is not configured on the server. Set GoogleSheets:Writer.");
|
|
}
|
|
}
|
|
}
|