Proper way to show users error info in the UI for addons Are there standardized features in the python API for displaying the popup and error message that users typically see in Blender when they're not doing something the right way?

Trying to apply a modifier in edit mode, for instance...or when there is an exception, you get a popup with a red triangle and a description, and there is a message printed in the info header (see screenshot below). From my searching in the API and around the web, it seems like the answer is no.



I can otherwise just make my own panel and popup for this that replicates that functionality. The only thing left to do for this is identify the remaining parts of the API that are relevant to replicate:


UI popup
Found this an answer via TynkaTopi on the #blendercoders IRC channel:

Blender operators have a method called report() which will perform the functions noted above. You only need to pass it a TYPE (an enum, see the docs) and a MESSAGE (a string explaining the error). It flashes a popup dialog with a warning icon/message at the mouse location, prints the error message in the info header, and adds it to a text datablock containing recent reports, apparently.

I also made sure to return {'CANCELLED'} from my operator after reporting when the error occurred.

API:
https://docs.blender.org/api/current/bpy.types.Operator.html?highlight=report#bpy.types.Operator.report

Example:

self.report({"WARNING"}, "Something isn't right")
# return {"CANCELLED"}