RunicHostedApplicationException class

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public sealed class RunicHostedApplicationException : Exception

Inherits or implements Exception.

A Runic application could not be hosted in another one's windows (the Runic host protocol, runic-host/1): the guest's hosted start, or a host's start of a guest, failed.

Remarks

A guest started with RunicDesktopHostOptions.Guest throws it from RunicDesktopHost.Run before its body runs, and a host or RunicTestHost throws it when it cannot start a guest. RunicHostedApplicationException.Code says why. The codes are an open set; a later release can add some:

  • offer-missing – Guest: standard input ended, or the start timeout passed, before the host's offer.
  • offer-invalid – Guest: the offer line is not valid.
  • protocol-unsupported – The host and the guest share no protocol version.
  • host-not-accepted – Guest: RunicGuestOptions.AcceptHost declined the host.
  • guest-elevated, guest-other-user – Guest: it runs elevated, and it or its host did not allow an elevated pair; or it runs as another user than its parent.
  • guest-elevated-host-not-elevated – Guest: it runs elevated and both sides allow an elevated pair, but its parent does not run elevated.
  • network-exposure – Guest: its Desktop host listens on other interfaces than loopback.
  • handshake-timeout, handshake-invalid, host-gone – Guest: no valid authenticated hello arrived in time, or standard input ended first.
  • guest-start-failed – Host: the guest's executable could not be started or contained (Exception.InnerException).
  • host-not-elevated – Host: it allows an elevated guest (RunicGuestStartInfo.AllowElevatedGuest) but does not run elevated; no guest started.
  • guest-start-timeout, guest-exited, guest-not-hostable, guest-refused – Host: the guest wrote no channel line or answered no hello in time, exited first, could not be authenticated, or refused for another reason (RunicHostedApplicationException.GuestCode).

The protocol and this type are experimental; see docs/experimental.md.

Constructors

RunicHostedApplicationException

public RunicHostedApplicationException(string code, string message)

Creates the exception with its failure code and message.

Parameters

code

The failure code, a kebab-case token.

message

A human-readable explanation.

RunicHostedApplicationException

public RunicHostedApplicationException(string code, string message, Exception? innerException)

Creates the exception with its failure code, message and cause.

Parameters

code

The failure code, a kebab-case token.

message

A human-readable explanation.

innerException

The failure that caused it, if any.

Properties

Code

public string Code { get; }

Why the hosted start failed: a kebab-case token of the open set listed on the type.

GuestCode

public string? GuestCode { get; init; }

For a host's guest-refused or protocol-unsupported: the code of the guest's refusal line, such as host-not-accepted; otherwise null.