YOUSEFUL / DELPHI / COMPONENTS

EAtlasUpdate

Raised by TAtlasWebUpdater for refused manifests, URLs, versions and limits, HTTP errors, and downloads that fail verification.

Class Unit Atlas.Updater · Inherits Exception · Product Atlas UI

Description

The messages are: Manifest exceeds 64 KiB, Manifest must be a JSON object, Unsupported manifest schema, Version must have three or four numeric parts, Empty version part, Version parts must be numeric, Version part out of range, Invalid update URL, Updates require HTTPS, Manifest size outside configured limit, SHA-256 must have 64 hexadecimal characters, Invalid SHA-256, Maximum bytes must be 1..1 GiB, HTTP status <code>, Download exceeds size limit, An explicit cache directory is required, Download size does not match manifest, Download SHA-256 does not match manifest and Existing cache file has different content. Other failures surface as RTL exceptions: EJSONException for a missing manifest field, ENetHTTPClientException when the server cannot be reached, ENetURIException for a URL that cannot be parsed, and file-system exceptions while writing the cache. A failed StageUpdate never leaves a partial or unverified file in the cache folder.

This type has no members of its own beyond those listed in its description.

Examples

Tell refused updates from other failures

Fetches a manifest and stages the update, and sorts failures into refused (the component's own checks), a bad manifest and everything else.

pascal
uses System.SysUtils, System.JSON, Atlas.Updater;

// Fetches and stages an update and says why it failed, if it did.
function StageOrExplain(Updater: TAtlasWebUpdater; const ManifestURL, CacheFolder: string;
  out StagedFile: string): string;
var
  Info: TAtlasUpdateInfo;
begin
  StagedFile := '';
  Result := '';
  try
    Info := Updater.FetchManifest(ManifestURL);
    StagedFile := Updater.StageUpdate(Info, CacheFolder);
  except
    on E: EAtlasUpdate do
      Result := 'Refused: ' + E.Message;       // policy, HTTP status, size or digest mismatch
    on E: EJSONException do
      Result := 'Bad manifest: ' + E.Message;  // a required field is missing
    on E: Exception do
      Result := 'Failed: ' + E.Message;        // network (ENetHTTPClientException), file system
  end;
end;

TAtlasWebUpdater · TAtlasUpdateInfo

Also in Atlas UI

TAtlasKanbanModel · TAtlasKanban · TAtlasSyntaxMemo · TAtlasWebUpdater