สร้าง Error สำหรับ Table.View Handlers
=Table.ViewError(error as record) as any
=Table.ViewError(error as record) as any
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
| error | record | Yes | Record ที่ระบุรายละเอียดของ Error (เช่น Reason, Message) |
Custom Connector Error Handling
Table.ViewError([Reason = "CustomError", Message = "Something went wrong"])=Table.ViewError([Reason = "CustomError", Message = "Something went wrong"])
Error Record
let View = Table.View(null, [ GetRows = () => ..., OnInvoke = (function, args) => if function = "RestrictedFunction" then Table.ViewError([Reason = "AccessDenie…let
View = Table.View(null, [
GetRows = () => ...,
OnInvoke = (function, args) =>
if function = "RestrictedFunction" then
Table.ViewError([Reason = "AccessDenied", Message = "Function not allowed"])
else
...
])
in
View
Table View or Error
Table.ViewError([ Reason = "Expression.Error", Message = "Column not found", Detail = "Column ID does not exist" ])=Table.ViewError([
Reason = "Expression.Error",
Message = "Column not found",
Detail = "Column ID does not exist"
])
Error with Detail
ฟังก์ชัน Table.ViewError ใช้สำหรับโยน (Raise) Error ในบริบทของการทำงานของ Table.View โดยเฉพาะ เพื่อแจ้งให้ M Engine ทราบว่าเกิดข้อผิดพลาดที่ระดับ View Handlers