You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,6 +11,9 @@ This custom error handler plugin allows a single module to process error message
11
11
- No specific error type is required for this module. It can parse any error types.
12
12
- Propagate errors from sys/prc layer back to exp layer, cementing error propagation across layers.
13
13
- To propagate the errors, ensure the appropriate variable name is referenced in the previous error section.
14
+
- Support for Mule error components to be factored into the error message based on boolean fields.
15
+
- Using Mule Error components will give very prescriptive error messages.
16
+
- Support for debug log package: `org.mulesoft.modules.errorhandler`
14
17
15
18
## Operations Supported
16
19
On Error
@@ -42,6 +45,10 @@ Add this dependency to your application pom.xml
42
45
- Delete the auto-generated error blocks (on-error-propagate/on-error-continue) before using this module.
43
46
- Place the plugin inside an error block (on-error-propagate/on-error-continue) along with a variable for httpStatus.
44
47
48
+
### Error Handler Config
49
+
Error handler application details have been moved into it's own config.
50
+

51
+
45
52
## HTTP Listener Configuration
46
53
The error response should be changed to the following to send back the populated error message.
47
54
```
@@ -60,7 +67,6 @@ The error response should be changed to the following to send back the populated
60
67
61
68
### General
62
69
63
-
- Takes values for apiName and apiVersion. Current default values will be read from a property file `api.name` and `api.version` respectively.
64
70
- Takes value for the previous error message that needs to be propagated. It has to be of type `array`.
65
71

66
72
- Error section defines from what mule expression should the error be read.
@@ -73,15 +79,48 @@ The error response should be changed to the following to send back the populated
73
79
### Common Errors
74
80
Common HTTP based errors are defined in this section. Users have to provide the message they want to send back on the API error response.
75
81
82
+
A boolean field `Default Error Description` has been enabled. If this is set to true, then the error message will be taken from the error description generated by Mule.
83
+
84
+
If the field is set to false, then whatever literal value is provided on the UI will be used to populate the error message.
85
+
86
+
The default value is `true`.
87
+
76
88

77
89
78
90
### Custom Errors (`,` Delimited)
79
91
80
-
Currently due to a limitation on XML SDK, text based entries are required for custom errors. The number of entries have to match else it will fail to be successfully executed.
92
+
Custom errors are now supported through a user defined JSON or Dataweave File. Users can provide the file through the custom error content section. The default value is `{}`.
81
93
82
-
errorTypes: Have to provided as `,` separated values. Example : DB:BAD_SQL_SYNTAX, ABC:DEF
83
-
errorCodes: Have to provided as `,` separated values. Example : 500, 599
84
-
errorMessages: Have to provided as `,` separated values. Example : SQL Syntax is incorrect, Testing
94
+
Create a custom errors file inside src/main/resources and then reference it as shown in the image. A sample content of the file is provided below.
95
+
96
+
A copy of the file is included in the source code of the plugin. The file is called `sampleCustomErrors.dwl`.
97
+
98
+
**Sample Content**
99
+
```
100
+
%dw 2.0
101
+
output application/java
102
+
---
103
+
{
104
+
"MULE:EXPRESSION": {
105
+
"errorCode": 500,
106
+
"reason": "UNKNOWN",
107
+
"defaultError": error.description,
108
+
"errorType": "MULE:EXPRESSION"
109
+
},
110
+
"UNKNOWN": {
111
+
"errorCode": 500,
112
+
"reason": "UNKNOWN",
113
+
"defaultError": error.description ,
114
+
"errorType": "MULE:EXPRESSION"
115
+
},
116
+
"VALIDATION:INVALID_BOOLEAN": {
117
+
"errorCode": 500,
118
+
"reason": "UNKNOWN",
119
+
"defaultError": error.description, // read error from the application
120
+
"errorType": "MULE:EXPRESSION"
121
+
}
122
+
}
123
+
```
85
124
86
125

87
126
@@ -93,29 +132,20 @@ A correlationId will be used for tracking transactions. The default value is #[c
0 commit comments