Maestro v2.0.0-beta.16 Release Notes

Release Date: 2020-06-29 // almost 4 years ago
  • 🚀 Happy Monday, we would like to release conditional logic and error handling to the public for you to try out. These will be the last features before the v2.0.0 release and we would love to get your feedback.

    Conditions

    Conditions could be wrapped around resources. The wrapped resources are executed if the condition results in a boolean which is true.
    Conditions could be nested and resources inside a condition block could be referenced inside other resources and the output.

    flow "condition" { input "schema.Object" {} if "{{ input:kind }} == 'INSERT'" { resource "insert" {} if "{{ insert:upgrade }} == true" { resource "upgrade" {} } } }
    

    Error Handling

    Custom error messages, status codes and response objects could be defined inside your flows.
    These objects could reference properties and be overriden with constant values.
    Error handling consists out of two blocks. error which defines the custom response object.
    These objects are returned to the user if the protocol allows for dynamic error objects (such as HTTP).
    on_error allows for the definitions of parameters (params) and to override the message and status properties.
    Optionally could a schema be defined. This schema is used to decode the received message.
    0️⃣ The default error properties (message and status), error params and other resources could be referenced inside the on_error and error blocks.

    flow "greeter" { on\_error { message = "unexpected error" status = 500 } resource "echo" { error "com.Schema" { message "meta" { status = "{{ error:status }}" trace = "{{ error.params:trace }}" } message = "{{ error:message }}" } on\_error { schema = "com.Schema" message = "{{ echo.error:message }}" status = 401params { trace = "{{ echo.error:trace }}" } } } }
    

    If no error object is defined is the parent error object copied.

    error "com.Schema" { message "meta" { status = "{{ error:status }}" } message = "{{ error:message }}"}flow "greeter" { # copies the global error object if not setresource "echo" { # copies the flow error object if not set } }