Skip to content

Commit

Permalink
upsi. merging is hard
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes committed Sep 26, 2024
1 parent 0789910 commit 976a4ea
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Sentry/Http/HttpTransportBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,20 @@ private async Task HandleFailureAsync(HttpResponseMessage response, Envelope env
var destination = Path.Combine(destinationDirectory, "envelope_too_large",
(eventId ?? SentryId.Create()).ToString());

Directory.CreateDirectory(Path.GetDirectoryName(destination)!);
var createDirectoryResult = _options.FileSystem.CreateDirectory(Path.GetDirectoryName(destination)!);
if (createDirectoryResult is not FileOperationResult.Success)
{
_options.DiagnosticLogger.LogError("Failed to create directory to store the envelope: {0}", createDirectoryResult);
return;
}

var result = _options.FileSystem.CreateFileForWriting(destination, out var envelopeFile);
if (result is not FileOperationResult.Success)
{
_options.DiagnosticLogger.LogError("Failed to create envelope file: {0}", result);
return;
}

var envelopeFile = File.Create(destination);
#if NETFRAMEWORK || NETSTANDARD2_0
using (envelopeFile)
#else
Expand Down

0 comments on commit 976a4ea

Please sign in to comment.