问题描述
请您提示我,在哪里可以找到结束编辑 Power BI 报告的配置代码(如下)。
服务器:PowerBI
报告类型:分页报告(SSRS 模拟)
配置代码:
from contextlib import ContextDecorator
class mycontext(ContextDecorator):
def __enter__(self):
print('Starting')
return self
def __exit__(self,*exc):
print('Finishing')
return False
>>> @mycontext()
... def function():
... print('The bit in the middle')
...
>>> function()
Starting
The bit in the middle
Finishing
>>> with mycontext():
... print('The bit in the middle')
...
Starting
The bit in the middle
Finishing
https://docs.microsoft.com/en-us/javascript/api/overview/powerbi/override-error-messages
解决方法
没有要编辑的配置。您问题中的文章建议handle the errors yourself。 hideErrors: true
表示 Power BI 不会显示错误。然后您必须处理 error
事件并向用户显示一条消息,表明发生了一些事情。将显示什么取决于您。 event
参数中将提供有关实际错误的信息。如果出现错误,它将实现 IError
接口,您可以查看 message
、detailedMessage
和 errorCode
属性的值来决定向用户显示什么。
report.off("error");
report.on("error",function(event) {
// Handle errors <-- This is the place,where you must write code to show a message
});
有关在嵌入 Power BI 时如何处理事件的更深入信息,请参阅 How to handle events 文章。