Value.ViewError

ValueInternal

Creates a modified error record suitable for use in a view handler. Intended for internal use only.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Value.ViewError(errorRecord as record) as record

Parameters

NameTypeRequiredDescription
errorRecordrecordYesAn error record (with Reason, Message, and Detail fields) to transform for view handling.

Return Value

recordA modified error record formatted for consumption by the view infrastructure.

Remarks

This function is intended for internal use only and is not designed to be called directly in user-written M queries.

Value.ViewError is part of the Power Query view infrastructure — the mechanism that allows connectors and the engine to provide custom handling for operations on tables and other values. It transforms a standard M error record (containing Reason, Message, and Detail fields) into a form that the view layer can consume and route appropriately.

In practice, Value.ViewError works in conjunction with Table.View and Table.ViewError. When a custom connector implements Table.View to support query folding or custom operation handling, error conditions that arise during view operations are wrapped through Value.ViewError so the engine can:

  • Present the error to the user with the correct context.
  • Fall back to local evaluation if the view handler cannot process an operation.
  • Preserve structured error information across the view boundary.

The related function Table.ViewError serves a similar purpose specifically for table views. Value.ViewError is the more general counterpart that operates on any value, not just tables.

Calling Value.ViewError directly in a user query is not useful. The error record format and view-routing logic are engine internals.

Examples

Example 1: Passing an error record through Value.ViewError

let
    ErrorRec = [Reason = "DataSource.Error", Message = "Could not connect", Detail = null],
    ViewErr = Value.ViewError(ErrorRec)
in
    ViewErr[Reason]
Output
Result
1DataSource.Error

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks