10_Errors Flashcards
If there is no error handler defined then what is used?
Mule default error handler
Can the Mule default error handler be configured?
No
What happens to the flow when the Mule default error handler is used?
The execution of the flow is stopped (and information about the error is logged)
Give an example of 2 properties of the error object?
error.description - a string and error.errorType - an object
How are the error types identified?
Namespace and identifier e.g. HTTP:UNAUTHORIZED
What is the LHS and RHS of the example ‘HTTP:CONNECTIVITY’?
Namespace - LHS and Identifier - RHS
What is the most general error type?
ANY
Do error types follow a hierarchy?
Yes - each error type has a parent
Can the error be handled if it is under critical?
No - cannot be handled
What is the default success response for a HTTP Listener?
- payload
- status code 200
What is the default error response for a HTTP Listener?
- error description
- status code 500
Can you override the response values for a HTTP Listener?
Yes
Where can error handlers be added to?
- an Application (outside of flows)
- a flow
- a selection of one or more event processors
How many event processors can an error scope contain?
Any number of event processors.
What 2 types of error handler scopes are there?
On Error Continue
and On Error Propagate
What happens to the flow after the On Error Propagate/Continue error handler scope has been completed (regarding execution)?
The rest of the flow that threw the error will not be executed.
After the On Error Continue scope has been completed, what happens to the event?
It is passed up to the next level as if the flow execution had been completed successfully. (Key part here - thrown the the NEXT LEVEL, as the execution of the flow that threw the error will not execut)
An HTTP Listener will return what response after the flow throws an error to the On Error Propagate?
error response
An HTTP Listener will return what response after the flow throws an error to the On Error Continue?
successful response
Flow - no error handler. What happens?
Mule default error handler executed. Error response.
Flow - On Error Propagate scope. What happens when an error is thrown in the flow?
On Error Propagate error handler executed. Error thrown.
Flow - On Error Continue scope. What happens when an error is thrown in the flow.
On Error Continue error handler executed. Successful response. Rest of flow not executed.
Parent Flow - On Error Propagate, Flow Reference - Child Flow. Child Flow - On Error Propagate. Error occurs in the child flow, that happens?
Child Flow On Error Propagate scope executed. Throws error to next level. Parent Flow throws error. On Error Propagate scope executed. Error returned.
Parent Flow - On Error Continue Flow Reference - Child Flow. Child Flow - On Error Propagate. Error occurs in the child flow, that happens?
Child flow On Error Propagate error handler executed. Error thrown to next level (parent). On Error Continue error handler executed. Successful response returned.
Parent Flow - On Error Propagate or On Error Continue, Flow Reference - Child Flow. Child Flow - On Error Continue. Error occurs in the child flow, that happens?
On Error Continue error handler executed. Successful response returned. The Parent Flow is executed (subsequent processors ARE executed). Success or error response returned depending on subsequent processors.
Where should you put a default error handler for your application? (an application level error handler).
Typically, in the global configuration file.
How do you create an application level error handler?
- add an error handler outside a flow, typically, in the global configurations file
- Specify that this handler is to be the application’s default error handler (configurations).
Each error handler can contain one or more ?
error handler scopes
What can each of the error handler scopes specify?
The type of error that they will handle or a condition. If the condition evaluates to true then that scope will be executed.
If there are multiple error handler scopes, what error scope will be executed?
The first error scope that the condition evaluates to true.
What is the default error type?
ANY
What do you set to specify error execution upon a specigic confition?
Set the WHEN condition to a boolean DataWeave expression.
Examples of conditions that could be used in the when of a error handler?
error.errorType.namespace == ‘HTTP’
OR
error.cause.message contains ‘request unauthorized’
What flows can’t have error handlers?
subflows
If a flow does not have an error handler, what happens?
The error is handled by a scope in an application’s default error handler.
If a flow has an error handler, what happens when an error is thrown?
The error is handled by the first error scope whose condition evaluates to true. If no scope conditions are true, the error is handled by the Mule default error handler NOT any scope in an applications global default handler. Note: it says that the ‘first whose scope condition is true,which may propagate or continue otherwise it is handled by the Mule default error handler. ‘
If flow has no error handler, and the application default error handler has no matching scope condition. What happens when an error is thrown?
Mule default error handler is executed. Error rethrown. Error response returned.
If flow has no error handler, and the application default error handler has a matching scope condition. What happens when an error is thrown?
Application default error handler is executed. Error rethrown. Error response returned.
If flow has error handlers but none of the conditions are met on any, and the application default error handler has no matching scope condition. What happens when an error is thrown?
Mule default error handler executed. Error rethrown. Error returned.
If flow has error handlers but none of the conditions are met on any, and the application default error handler has a matching scope condition. What happens when an error is thrown?
Mule default error handler is executed. Error re-thrown. Error response.
How many processors can be added to a Try scope?
Any number of processors.
In an On Error Continue/Propagate in a Try scope, after an error has been thrown, what happens to the execution of the rest of the try scope?
The rest of the Try scope is not executed.
What happens to the error, if an On Error Propagate error handler is executed?
An error response is returned to the parent flow, which then handles the error.
What happens to the error, if an On Error Continue error handler is executed?
The event is passed up to the parent flow, which continues execution.
Try scope - On Error Propagate scope and Parent flow - On Error Propagate scope. What happens when the error occurs in the try scope?
On propagate handler executed. Error rethrown. On Error Propagate handler executed. Error rethrown. Error response.
Try scope - On Error Continue scope and Parent flow - On Error Propagate scope. What happens when the error occurs in the try scope?
On error propagate handler executed. Error rethrown. On error continue handler executed. Success response. Subsequent processors are NOT executed past the try scope.
Try scope - On Error Propagate scope and Parent flow - On Error Propagate OR Continue scope. What happens when the error occurs in the try scope?
On error continue handler executed. Success response rethrown. Subsequent processors are executed. A success of error response returned (base on the subsequent processors).
What’s one way you can make error handling more granular?
Add custom error types
When creating new customer error types, what should you not name them?
Existing module namespaces.
Interfaces created with APIkit have error handlers with what type of scope?
On Error Propagate scopes.
The main routing flow, from an interface created with APIkist has how many error scopes? Bonus - few examples?
6 (APIKIT:BAD_REQUEST > 400, APIKIT:NOT_FOUND > 404, APIKIT:METHOD_NOT_ALLOWED > 405,…)
An application can have what two types of errors?
Messaging (within a flow whenever a Mule event is involved) or System (system-level when no Mule event is involved).
When do system errors occur?
during application start-up or when a connection to an external system fails
How are system errors handled?
Through a system error handling strategy that is non-configurable. It will log the error and if it’s a connection failure - it will execute the re-connection strategy.
Where do you set the Re-connection strategies?
Set for a connector (in Global Elements Properties) for a specific connector operation (in Properties view)
What do the error scopes from the interfaces created with APIkit set?
HTTP status codes and response messages.
After an error scope has been executed from an interface that has been created by APIkit, where does it pass the event/error to?
Back to the main router (or main router flow)