Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Greetings, all. I am wanting a notebook to throw an error if a condition isn't met, and I want that error to show in a Data Factory pipeline that is triggering the notebook. How can I do this?
Solved! Go to Solution.
Thanks for the reply, @frithjof_v. The challenge there is I'd then need to add logic in the pipeline to evaluate whether or not the exit value output indicates an error.
The solution I found (which I found somewhere on the internet that I don't recall) is to use raise Exception("Error message here"). Here's a modified version of the code block; the vars are just fake examples of operations I am performing:
if var == None:
raise Exception("No match found.")
else:
var2 = var
This sends the exception back as an error to the pipeline so the Notebook activity actually fails, which is handy.
Hi @arpost ,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information and description to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
I think you can use exit value in Notebook.
And then use the Notebook exit value as input for an IF Condition activity in your data pipeline.
Thanks for the reply, @frithjof_v. The challenge there is I'd then need to add logic in the pipeline to evaluate whether or not the exit value output indicates an error.
The solution I found (which I found somewhere on the internet that I don't recall) is to use raise Exception("Error message here"). Here's a modified version of the code block; the vars are just fake examples of operations I am performing:
if var == None:
raise Exception("No match found.")
else:
var2 = var
This sends the exception back as an error to the pipeline so the Notebook activity actually fails, which is handy.
Nice, thanks for sharing!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Fabric update to learn about new features.