SDK API Reference / mapComposableJourneyWriteError
Function: mapComposableJourneyWriteError()
mapComposableJourneyWriteError(
kind,error,operation):unknown
Translate a composable journey write failure into something the user can act on.
Three shapes, all of which arrive as opaque HTTP errors:
- 400 or 422 saying a feature "is not supported" — a journey feature composable/M2 does not implement. The server is the only authority on which those are, so its own text is kept and the hint appended. Observed live (CAS-520 verification) as a 400
validation-errorwhose detail reads "ABTest step is not supported…", not the 422unsupported_*code the API docs describe — so both are matched, on the wording rather than the code. - 400 "Segments associated with the launched journey cannot be modified" — a launched composable journey's step segments are immutable; the user needs a new version, not a retry.
- 404 / 500 — on a
create, the account-not-enabled shapes, delegated to mapComposableDispatchError so the wording stays in one place. Both are hedged there: a create's 404 is also how a deleted parent folder comes back, and its 500 is also how a plain server fault does.
The enablement 404/500 carries nothing in its body to match on, which is why it is recognised by status alone — so operation has to do the disambiguating. On an update the journey id came from a listing seconds earlier, so a 404 means it has since been deleted, not that the account is disabled; and a 500 is just a server error. Telling that user to contact their CSM about enablement sends them somewhere with nothing to fix.
Returns the original error untouched for a complete audience, or for anything unrecognised — inventing a friendlier message for an unknown failure only hides it.
Parameters
kind
error
unknown
operation
Which write failed. create has no journey id in play, so a 404 there can only be the route or the account gate.
journeyName?
string
operation
"create" | "update"
Returns
unknown