Skip to content

Commit bc6c59d

Browse files
committed
add warning to misc
1 parent cdd284f commit bc6c59d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/reaction.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,17 @@ Example:
580580
reaction = @reaction k, 0 --> X, [misc="A reaction"]
581581
get_misc(reaction)
582582
```
583+
584+
Notes:
585+
- The `misc` field can contain any valid Julia structure. This mean that Catalyst cannot check it
586+
for symbolci variables that are added here. This means that symbolic variables (e.g. parameters of
587+
species) that are stored here are not accessible to Catalyst. This can cause troubles when e.g.
588+
creating a `ReactionSystem` programmatically (in which case any symbolic variables stored in the
589+
`misc` metadata field should also be explicitly provided to the `ReactionSystem` constructor).
590+
583591
"""
584592
function get_misc(reaction::Reaction)
585-
if has_description(reaction)
593+
if has_misc(reaction)
586594
return getmetadata(reaction, :misc)
587595
else
588596
error("Attempts to access `misc` metadata field for a reaction which does not have a value assigned for this metadata.")

test/reactionsystem_core/reaction.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ let
116116
@test !Catalyst.has_misc(r1)
117117
@test Catalyst.has_misc(r2)
118118
@test_throws Exception Catalyst.get_misc(r1)
119-
@test isequal(Catalyst.get_misc(r2), ('C', :C))
119+
@test isequal(Catalyst.get_misc(r2), ('M', :M))
120120
end

0 commit comments

Comments
 (0)