NickeManarin/ScreenToGif · error · Exception

history.Message

Error message

history.Message

What it means

After cloud.UploadFileAsync returns a History object, EncodingManager checks history.Result. If it is not 200, it throws new Exception(history.Message) — the message the cloud uploader set on its History. This is the non-throwing failure path of uploaders that report failure via the Result code rather than an exception.

Source

Thrown at ScreenToGif/Util/EncodingManager.cs:1172

                {
                    //Get selected preset.
                    var presetType = preset.Extension == ".zip" ? ExportFormats.Zip : preset.Type;
                    var uploadPreset = UserSettings.All.UploadPresets.OfType<UploadPreset>().FirstOrDefault(f => (f.AllowedTypes.Count == 0 || f.AllowedTypes.Contains(presetType)) && f.Title == preset.UploadService);

                    if (uploadPreset == null)
                        throw new Exception($"Missing upload preset called {preset.UploadService}");

                    //TODO: Limit upload by imposed service limits.

                    //Try uploading to the selected service.
                    var cloud = CloudFactory.CreateCloud(uploadPreset.Type);
                    var history = await cloud.UploadFileAsync(uploadPreset, preset.FullPath, CancellationToken.None);

                    uploadPreset.History.Add(history);
                    UserSettings.Save();

                    if (history.Result != 200)
                        throw new Exception(history.Message);

                    SetUpload(id, true, history.GetLink(uploadPreset), history.DeletionLink);
                }
                catch (Exception e)
                {
                    LogWriter.Log(e, "It was not possible to upload.");
                    SetUpload(id, false, null, null, e);
                }
                finally
                {
                    Update(id, 2, watch.Elapsed);
                    watch.Restart();
                }
            }

            #endregion

            #region Copy to clipboard

View on GitHub (pinned to a4d0a67c21)

Solutions

  1. Inspect history.Message — it usually contains the provider's error text (often mirroring error 22/24 for Imgur/Yandex).
  2. Re-run the upload after addressing the cause described in history.Message.
  3. Check the History entry appended to uploadPreset.History for the persisted error context.
  4. If the uploader should have thrown, harden it to throw UploadException on non-200 instead of returning a failure History.

Example fix

// before
if (history.Result != 200)
    throw new Exception(history.Message);

// after
if (history.Result != 200)
    throw new UploadException($"Upload to {uploadPreset.Title} failed ({history.Result}): {history.Message}");
Defensive patterns

Strategy: try-catch

Validate before calling

// Uploader implementers: throw UploadException on non-200 instead of returning a History
if (response.StatusCode != HttpStatusCode.OK)
    throw new UploadException($"HTTP {(int)response.StatusCode}");

Type guard

// n/a

Try / catch

var history = await cloud.UploadFileAsync(uploadPreset, path, token);
if (history.Result != 200)
    throw new UploadException($"Upload failed ({history.Result}): {history.Message}");

Prevention

When it happens

Trigger: UploadFileAsync returns a populated History with Result != 200 (e.g. 4xx/5xx captured inside the uploader without throwing, or a service-specific non-success code) and a non-null Message.

Common situations: Cloud provider returned an HTTP error that the uploader swallowed into the History object; partial upload; service-side validation rejection; rate-limit body returned with a non-200 status that the uploader chose not to throw on.

Related errors


AI-assisted analysis of NickeManarin/ScreenToGif@a4d0a67c21 (2026-08-13). Data as JSON: /api/errors/56f03e1fa40b44ce. Report an issue: GitHub.