Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/statifier/actions/assign_action.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,13 @@ defmodule Statifier.Actions.AssignAction do

{:error, reason} ->
# Create error.execution event per SCXML specification
error_event = %Event{
name: "error.execution",
data: %{
error_event =
Event.internal("error.execution", %{
"reason" => inspect(reason),
"type" => "assign.execution",
"location" => assign_action.location,
"expr" => assign_action.expr
},
origin: :internal
}
})

# Log the error and generate error.execution event per SCXML spec
state_chart
Expand Down
4 changes: 2 additions & 2 deletions lib/statifier/datamodel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ defmodule Statifier.Datamodel do
Set a value at a nested path in the datamodel.

Takes a datamodel, a list of path components (keys), and a value.
Creates intermediate maps as needed for nested assignment.
Does not create intermediate maps as needed for nested assignment.

## Examples

iex> datamodel = %{}
iex> Statifier.Datamodel.put_in_path(datamodel, ["user", "name"], "John")
{:ok, %{"user" => %{"name" => "John"}}}
{:error, "Cannot assign to nested path: 'user' does not exist"}

iex> datamodel = %{"user" => %{"age" => 30}}
iex> Statifier.Datamodel.put_in_path(datamodel, ["user", "name"], "Jane")
Expand Down
2 changes: 2 additions & 0 deletions test/statifier/datamodel_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ defmodule Statifier.DatamodelTest do
StateChart
}

doctest Statifier.Datamodel

# Helper function to initialize a state chart from XML
defp initialize_from_xml(xml) do
{:ok, document, _warnings} = Statifier.parse(xml)
Expand Down