As like in Java Exceptions hierarchy, Mule 4 come up with same patterns. The top most Error Type is ERRORS and its immediate Childs are ANY and CRITICAL
Mule Errors are divided in two segments separated by “:”. First part is namespace (Example: MULE, HTTP, FILE, DB) and second part is identifier (Example: SECURITY, CLIENT_SECURITY, UNAUTHORIZED, NOT_FOUND, CONNECTIVITY).
The namespace are unique and identifier can be duplicate, it means namespace are define based on domain (Ex: HTTP, FILE) and for each domain functionality can be same (Ex : NOT_FOUND). So, when define our custom Error type we have keep this in consideration.
Another important characteristic of error types is that they might have a parent type. For example, HTTP:UNAUTHORIZED has MULE:CLIENT_SECURITY as the parent, which, in turn, has MULE:SECURITY as the parent. This will help us to refer Global error handling and that will help us define Custom Error Types within our organisation.
The hierarchies means the routing can be more general, means MULE:SECURITY can catch HTTP:UNAUTHORIZED or Oauth Errors.
All errors are either ANY or CRITICAL. It’s important to note the UNKNOWN type, which is used when no clear reason for the failure is found. UNKNOWN is also can handle through ANY type.
In terms of Connectors, its defines its error type hierarchy considering the core runtime one. So, it is advised that when we create custom connectors we have to define the error type with respect to core runtime. CONNECTIVITY and RETRY_EXHAUSTED are the common types we have to define when we create custom connectors.
Comments