Pode.Web icon indicating copy to clipboard operation
Pode.Web copied to clipboard

Show Error Alert when Table fails to load data from scriptblock

Open Badgerati opened this issue 3 years ago • 1 comments

When building a table, if the scriptblock fails to run then an error alert should be displayed. For example, the table in the full.ps1 example to show services, when this is run on linux it just spins forever and ever, but on the terminal you see:

pode-web-example  | Date: 2022-11-06 17:51:46
pode-web-example  | Level: Error
pode-web-example  | ThreadId: 1
pode-web-example  | Server: f41c416fbc35
pode-web-example  | Category: System.Management.Automation
pode-web-example  | Message: The term 'Get-Service' is not recognized as a name of a cmdlet, function, script file, or executable program.
pode-web-example  | Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
pode-web-example  | StackTrace:    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
pode-web-example  |    at Invoke-PodeScriptBlock(Closure , FunctionContext )
pode-web-example  |    at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
pode-web-example  |    at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
pode-web-example  |    at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
pode-web-example  |    at System.Management.Automation.CommandProcessorBase.Complete()

Badgerati avatar Nov 06 '22 17:11 Badgerati

What about using a placeholder rather than an alert ? If the sciptblock failed: "An error happened while retrieving the data." And if the scriptblock succeeded but did not return anything: "There is no data."

phende avatar Jan 26 '23 13:01 phende