%dw 2.0
output application/json

type errorCode4xx = "400" | "401" | "404"

fun errorHandling(httpStatusCode: errorCode4xx, payload) = "Error Handling 4xx"

fun errorHandling(httpStatusCode: "500", payload) = "Error Handling 500"

fun errorHandling(httpStatusCode: "501", payload) = "Error Handling 501"
fun errorHandling(httpStatusCode: 243, payload) = "Error Handling 243"
fun errorHandling(httpStatusCode: 123, payload) = "Error Handling 123"
fun errorHandling(httpStatusCode: false, payload) = "Error Handling false"
fun errorHandling(httpStatusCode: true, payload) = "Error Handling true"

var a: errorCode4xx = "404"

---
{
    "a": errorHandling(in0.status, in0),
    "b": errorHandling(123, in0),
    "c": errorHandling(true, in0)
}