Table.ViewError

Table

Creates a modified error record that prevents fallback behavior when raised inside a Table.View handler.

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

Syntax

Table.ViewError(errorRecord as record) as record

Parameters

NameTypeRequiredDescription
errorRecordrecordYesAn error record to modify so that it bypasses the normal fallback mechanism in Table.View handlers.

Return Value

recordA modified error record that will propagate to the caller instead of triggering fallback behavior.

Remarks

Table.ViewError is a companion to Table.View used in custom connector development. Normally, when a handler function in a Table.View raises an error, the Power Query engine falls back to executing the operation against the base table using default in-memory behavior. This fallback is usually desirable — it means partial folding still works.

However, there are cases where you want an error to propagate directly to the user instead of silently falling back. For example, if a data source returns an authentication error or a query syntax error, falling back would mask the real problem. Wrapping the error record with Table.ViewError ensures the error reaches the caller.

This function is primarily used by connector developers, not in ad-hoc M queries.

Examples

Example 1: Raise a non-fallback error from a view handler

let
    View = Table.View(
        null,
        [
            GetType = () => type table [ID = number, Name = text],
            GetRows = () => error Table.ViewError(
                [Reason = "DataSource.Error", Message = "Authentication expired"]
            )
        ]
    )
in
    View

Compatibility

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