workflowhttp

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package workflowhttp maps the errors of vogel/workflow to HTTP status codes and the error codes of vogel/httpx/response. It is a separate package so the workflow engine itself stays free of any HTTP dependency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Status

func Status(err error) (status int, code string, ok bool)

Status returns the HTTP status and response code for err when it wraps a workflow sentinel a client can cause (checked with errors.Is), and ok = false otherwise. A caller writes the mapped response when ok is true, and logs err and answers 500 when it is false:

if status, code, ok := workflowhttp.Status(err); ok {
	response.Error(w, r, status, code, err.Error())
	return
}

The mapping is:

  • 404 NOT_FOUND: ErrCaseNotFound, ErrTokenNotFound.
  • 409 CONFLICT: ErrConflict, ErrAlreadyAssigned, ErrCaseClosed, ErrInvalidTransition, ErrReturnNotVisited, ErrNoRoute, ErrGuardRejected, ErrLastBranch, ErrJoinRejected, ErrAlreadyExpired, ErrNotOverdue, ErrCaseExists, ErrNotAssigned.
  • 422 UNPROCESSABLE_ENTITY: ErrCommentRequired, ErrCommentNotAllowed, ErrReasonRequired, ErrTokenRequired, ErrInvalidActor.
  • 400 VALIDATION_ERROR: ErrOffsetOutOfRange.

Every other error, ErrInvalidDefinition, ErrUnknownEffect and ErrTooManyDecisionHops included, is not mapped.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL