Skip to main content
Table of Contents

Class SessionRequiredException

Namespace
Stratara.Abstractions.Session
Assembly
Stratara.Abstractions.dll

Thrown when an operation that must be attributed to a caller — saving events, recording a command audit, dispatching a command — runs with no session context set.

public sealed class SessionRequiredException : InvalidOperationException, ISerializable
Inheritance
SessionRequiredException
Implements
Inherited Members
Extension Methods

Remarks

The session middleware sets no session for an unauthenticated request, so on an HTTP host this failure means the caller carries no identity. The opt-in problem-details mapping answers it with 401 for a caller that is not authenticated; for an authenticated caller it is left unconverted, because there it means the host did not establish the session context.

Derives from InvalidOperationException, so a handler that catches that type keeps catching this one. Lives in Stratara.Abstractions so a host can catch it without referencing any store or broker package.

Constructors

SessionRequiredException()

Initializes the exception with a default message.

public SessionRequiredException()

SessionRequiredException(string)

Initializes the exception with the specified message.

public SessionRequiredException(string message)

Parameters

message string

A human-readable description of the operation that needed a session.

SessionRequiredException(string, Exception?)

Initializes the exception with the specified message and the failure that caused it.

public SessionRequiredException(string message, Exception? innerException)

Parameters

message string

A human-readable description of the operation that needed a session.

innerException Exception

The failure that caused this one.