---
title: Signal a view/context failure
summary: Signal a presentation-layer routing failure with a target view and optional model.
status: draft
owner: saif-docgen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common
reference_type: package
operation_id: OP-020
trigger: A consuming presentation layer detects a missing, invalid, unauthorized-for-user, or disabled context*
---

# Signal a view/context failure

Signal a presentation-layer routing failure with a target view and optional model, triggered when a consuming presentation layer detects a missing, invalid, unauthorized-for-user, or disabled context*.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-020 |
| **Trigger** | A consuming presentation layer detects a missing, invalid, unauthorized-for-user, or disabled context* |
| **Inputs** | none / `targetView` / `model` |
| **Outputs** | An exception carrying `TargetView` and optionally `Model` |
| **Primary components** | ``ContextException` and subclasses `NoContextException`, `InvalidContextException`, `InvalidContextForUserException`, `DisabledViewException`` |
| **Entry point** | `Common/SAIF.Common/Classes/ContextException.cs` |

## Steps

1. The caller selects the subclass matching the failure condition. ([BR-048](../business-rules.md#br-048-each-context-failure-condition-maps-to-a-fixed-default-target-view-name))
2. The parameterless (or `model`) constructor stamps a default `TargetView` equal to the condition name: `"NoContext"`, `"InvalidContext"`, `"InvalidContextForUser"`, `"DisabledView"`. ([BR-048](../business-rules.md#br-048-each-context-failure-condition-maps-to-a-fixed-default-target-view-name))
3. The `(string targetView)` overload on every subclass overrides that default with a caller-supplied view name. On `DisabledViewException` this overload does not set `Model`. ([BR-048](../business-rules.md#br-048-each-context-failure-condition-maps-to-a-fixed-default-target-view-name))
4. `DisabledViewException(object model)` additionally attaches the model payload for redisplay. ([BR-048](../business-rules.md#br-048-each-context-failure-condition-maps-to-a-fixed-default-target-view-name))
5. The consuming layer catches `ContextException` and routes to `TargetView`, passing `Model`.* ([BR-048](../business-rules.md#br-048-each-context-failure-condition-maps-to-a-fixed-default-target-view-name))

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["Presentation layer detects<br>a context failure"]) --> Select["Select ContextException subclass<br>matching the failure condition"]
	Select --> Default["Ctor stamps default TargetView<br>equal to condition name"]
	Default --> Override{"targetView overload used?"}
	Override -->|Yes| SetView["Override default with<br>caller-supplied view name"]
	Override -->|No| ModelCheck
	SetView --> ModelCheck{"DisabledViewException(model)<br>constructor used?"}
	ModelCheck -->|Yes| AttachModel["Attach model payload<br>for redisplay"]
	ModelCheck -->|No| Throw
	AttachModel --> Throw["Exception thrown"]
	Throw --> Catch["Consuming layer catches<br>ContextException"]
	Catch --> End(["Route to TargetView,<br>passing Model"])
```

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- `Common/SAIF.Common/Classes/ContextException.cs`
