Skip to content

Commit 8e7c533

Browse files
committed
Set the category to 'random' for failures from random choice.
1 parent 8a8ad28 commit 8e7c533

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/microbit/modrandom.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ STATIC mp_obj_t mod_random_choice(mp_obj_t seq) {
122122
if (get_random_choice(&marker_len, &marker_result)) {
123123
if (len != marker_len) {
124124
// Report failure, but continue to use random anyway.
125-
set_marker_failure_event("Incorrect number of items passed to random.choice.");
125+
set_marker_failure_event("random", "Incorrect number of items passed to random.choice.");
126126
} else {
127127
// The marker can also optionally set a forced result
128128
// which is the repr() of the expected item.
@@ -143,7 +143,7 @@ STATIC mp_obj_t mod_random_choice(mp_obj_t seq) {
143143
++i;
144144
}
145145
if (index < 0) {
146-
set_marker_failure_event("Item missing from random.choice.");
146+
set_marker_failure_event("random", "Item missing from random.choice.");
147147
index = randbelow(len);
148148
}
149149
return mp_obj_subscr(seq, mp_obj_new_int(index), MP_OBJ_SENTINEL);

0 commit comments

Comments
 (0)