Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Stharwani
Advocate II
Advocate II

Error Handling in M

Hello,

 

I am building a Custom Connector to get data from a web sevrice. There are instances where the data would be null. Is tehre any error handling mechanism where it if it runs into an error, it can skip it and move on. Like Try catch?

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee


@Stharwani wrote:

Hello,

 

I am building a Custom Connector to get data from a web sevrice. There are instances where the data would be null. Is tehre any error handling mechanism where it if it runs into an error, it can skip it and move on. Like Try catch?


@Stharwani

I'm not a M master, but based on my test, there's some error handling mechanism in M, at least the "try" word works some way. The M code below processes to last step though there's error midway. 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlSK1YlWSgKTyUqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    //change the type of an non-existing column
    #"Changed Type1" = try Table.TransformColumnTypes(#"Changed Type",{{"addAnewCol", Int64.Type}}),
    #"Final result" = #"Changed Type"
in
    #"Final result"

Could you be more specifc on your scenario, what kind of web service? I think you might add a check null step.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.