dotnet format fixes (only this PR's touched lines)

This commit is contained in:
Leonardo Mosquera 2025-04-01 12:53:34 -03:00
parent daff360ce4
commit f526dbe213
6 changed files with 20 additions and 13 deletions

View file

@ -173,8 +173,6 @@ public class DateRangeSpecs
.Select(j => j.GetProperty("timestamp").GetDateTimeOffset())
.ToArray();
timestamps
.Should()
.BeEmpty();
timestamps.Should().BeEmpty();
}
}

View file

@ -237,7 +237,8 @@ public abstract class ExportCommandBase : DiscordCommandBase
}
);
}
catch (ChannelEmptyException ex) {
catch (ChannelEmptyException ex)
{
warningsByChannel[channel] = ex.Message;
}
catch (DiscordChatExporterException ex) when (!ex.IsFatal)
@ -285,9 +286,7 @@ public abstract class ExportCommandBase : DiscordCommandBase
using (console.WithForegroundColor(ConsoleColor.Red))
{
await console.Error.WriteLineAsync(
$"Failed to export the following channel(s):"
);
await console.Error.WriteLineAsync($"Failed to export the following channel(s):");
}
foreach (var (channel, message) in errorsByChannel)

View file

@ -5,5 +5,5 @@ namespace DiscordChatExporter.Core.Exceptions;
// Thrown when there is circumstancially no message to export with given parameters,
// though it should not be treated as a runtime error; simply warn instead
public class ChannelEmptyException(string message)
: DiscordChatExporterException(message, false, null) {
}
: DiscordChatExporterException(message, false, null)
{ }

View file

@ -45,8 +45,16 @@ public class ChannelExporter(DiscordClient discord)
}
// Check if the 'before' and 'after' boundaries are valid
if ((request.Before is not null && !request.Channel.MayHaveMessagesBefore(request.Before.Value)) ||
(request.After is not null && !request.Channel.MayHaveMessagesAfter(request.After.Value)))
if (
(
request.Before is not null
&& !request.Channel.MayHaveMessagesBefore(request.Before.Value)
)
|| (
request.After is not null
&& !request.Channel.MayHaveMessagesAfter(request.After.Value)
)
)
{
throw new ChannelEmptyException(
$"Channel '{request.Channel.Name}' "

View file

@ -70,7 +70,8 @@ internal partial class MessageExporter(ExportContext context) : IAsyncDisposable
MessagesExported++;
}
public async ValueTask DisposeAsync() {
public async ValueTask DisposeAsync()
{
// causes the file to be created whether there were messages written or not
await GetWriterAsync();
await ResetWriterAsync();

View file

@ -283,7 +283,8 @@ public partial class DashboardViewModel : ViewModelBase
Interlocked.Increment(ref successfulExportCount);
}
catch (ChannelEmptyException ex) {
catch (ChannelEmptyException ex)
{
_snackbarManager.Notify(ex.Message.TrimEnd('.'));
// FIXME: not exactly successful, but not a failure either. Not ideal to duplicate the line