---
title: "UML Statechart tip: Handling errors when entering a state"
url: https://daily.dev/posts/uml-statechart-tip-handling-errors-when-entering-a-state-ibgmlap8a
source_url: https://www.embeddedrelated.com/showarticle/1334.php
type: article
source: "EmbeddedRelated"
published: 2026-05-31T07:47:55.569Z
updated: 2026-05-31T09:12:22.082Z
tags: ["architecture", "embedded", "firmware"]
reading_time: 8
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# UML Statechart tip: Handling errors when entering a state

**[EmbeddedRelated](https://daily.dev/sources/embeddedrelated)** · 8 min read · 0 upvotes · 0 comments

## Summary

Handling synchronous errors during state entry in UML statecharts is non-trivial because the UML spec forbids transitions inside entry actions. Three practical firmware patterns are compared: (1) Explicit guarded transitions — simple and UML-compliant but can violate DRY in larger codebases; (2) Failure-event self-posting via a LIFO queue — keeps logic contained in one state but requires framework support and breaks with multiple error conditions; (3) Asynchronous service — converts the synchronous operation into an async one with explicit success/failure events, preferred for larger teams and complex projects despite added complexity. Each approach is evaluated with concrete trade-offs and guidance on when to apply it based on project size and team scale.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.embeddedrelated.com/showarticle/1334.php>

## Similar posts on daily.dev

- [Welcome to the State Machine Pattern](https://daily.dev/posts/welcome-to-the-state-machine-pattern-5itzjs3mx) · W endell Adriel · 84 upvotes · 1 comments
- [Do you need to build a State Machine at least once in your career?](https://daily.dev/posts/do-you-need-to-build-a-state-machine-at-least-once-in-your-career--e8ny0dmmn) · RUBYLAND · 0 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#embedded](https://daily.dev/tags/embedded), [#firmware](https://daily.dev/tags/firmware)

[View this post on daily.dev](https://daily.dev/posts/uml-statechart-tip-handling-errors-when-entering-a-state-ibgmlap8a)
