@@ -40,7 +40,7 @@ impl @counter {
40
40
item: id
41
41
}
42
42
} else {
43
- error "Can not make counter from this type"
43
+ throw "Can not make counter from this type"
44
44
}
45
45
46
46
},
@@ -182,7 +182,7 @@ impl @counter {
182
182
temp.add_to([self.item], speed)
183
183
184
184
} else {
185
- error "Cannot multiply counter by " + factor.type as @string
185
+ throw "Cannot multiply counter by " + factor.type as @string
186
186
}
187
187
},
188
188
@@ -228,7 +228,7 @@ impl @counter {
228
228
}
229
229
div!
230
230
} else if divisor.type == @counter {
231
- //error "Dividing a counter by another counter is currently not supported"
231
+ //throw "Dividing a counter by another counter is currently not supported"
232
232
result = @counter::new(0, false)
233
233
remainder.reset(speed)
234
234
delay = @epsilon::{}
@@ -289,7 +289,7 @@ impl @counter {
289
289
290
290
291
291
} else {
292
- error "Cannot divide counter by " + divisor.type as @string
292
+ throw "Cannot divide counter by " + divisor.type as @string
293
293
}
294
294
295
295
@@ -399,7 +399,7 @@ impl @counter {
399
399
other.clone().add_to([new_counter.item])
400
400
-> return new_counter
401
401
} else {
402
- error "Cannot add counter with " + num.type as @string
402
+ throw "Cannot add counter with " + num.type as @string
403
403
}
404
404
},
405
405
@@ -409,7 +409,7 @@ impl @counter {
409
409
new_counter.add(-other)
410
410
-> return new_counter
411
411
} else {
412
- error "Cannot subtract counter with " + num.type as @string
412
+ throw "Cannot subtract counter with " + num.type as @string
413
413
}
414
414
},
415
415
@@ -457,7 +457,7 @@ impl @counter {
457
457
cmp = self_clone.compare(other_clone)
458
458
-> return cmp == 1
459
459
} else {
460
- error "Cannot compare counter with " + other.type as @string
460
+ throw "Cannot compare counter with " + other.type as @string
461
461
}
462
462
},
463
463
@@ -478,7 +478,7 @@ impl @counter {
478
478
cmp = self_clone.compare(other_clone)
479
479
-> return cmp == -1
480
480
} else {
481
- error "Cannot compare counter with " + other.type as @string
481
+ throw "Cannot compare counter with " + other.type as @string
482
482
}
483
483
},
484
484
@@ -499,7 +499,7 @@ impl @counter {
499
499
cmp = self_clone.compare(other_clone)
500
500
-> return cmp == 1 || cmp == 0
501
501
} else {
502
- error "Cannot compare counter with " + other.type as @string
502
+ throw "Cannot compare counter with " + other.type as @string
503
503
}
504
504
},
505
505
@@ -520,7 +520,7 @@ impl @counter {
520
520
cmp = self_clone.compare(other_clone)
521
521
-> return cmp == -1 || cmp == 0
522
522
} else {
523
- error "Cannot compare counter with " + other.type as @string
523
+ throw "Cannot compare counter with " + other.type as @string
524
524
}
525
525
},
526
526
@@ -543,7 +543,7 @@ impl @counter {
543
543
cmp = self_clone.compare(other_clone)
544
544
-> return cmp == 0
545
545
} else {
546
- error "Cannot compare counter with " + other.type as @string
546
+ throw "Cannot compare counter with " + other.type as @string
547
547
}
548
548
},
549
549
@@ -563,7 +563,7 @@ impl @counter {
563
563
} else if num.type == @counter {
564
564
num.clone().add_to([self])
565
565
} else {
566
- error "Cannot add " + num.type as @string + " to counter"
566
+ throw "Cannot add " + num.type as @string + " to counter"
567
567
}
568
568
},
569
569
@@ -575,7 +575,7 @@ impl @counter {
575
575
} else if num.type == @counter {
576
576
num.clone().subtract_from([self])
577
577
} else {
578
- error "Cannot subtract " + num.type as @string + " from counter"
578
+ throw "Cannot subtract " + num.type as @string + " from counter"
579
579
}
580
580
},
581
581
@@ -586,7 +586,7 @@ impl @counter {
586
586
} else if num.type == @counter {
587
587
self.multiply(num)
588
588
} else {
589
- error "Cannot multiply counter by " + num.type as @string
589
+ throw "Cannot multiply counter by " + num.type as @string
590
590
}
591
591
},
592
592
@@ -596,7 +596,7 @@ impl @counter {
596
596
} else if num.type == @counter {
597
597
self.divide(num)
598
598
} else {
599
- error "Cannot divide counter by " + num.type as @string
599
+ throw "Cannot divide counter by " + num.type as @string
600
600
}
601
601
},
602
602
@@ -609,7 +609,7 @@ impl @counter {
609
609
} else if num.type == @counter {
610
610
num.copy_to([self])
611
611
} else {
612
- error "Cannot assign" + num.type as @string + " to counter"
612
+ throw "Cannot assign" + num.type as @string + " to counter"
613
613
}
614
614
},
615
615
@@ -623,7 +623,7 @@ impl @counter {
623
623
wait()
624
624
swap_tmp.copy_to([self]);
625
625
} else {
626
- error "Cannot swap counter with " + num.type as @string
626
+ throw "Cannot swap counter with " + num.type as @string
627
627
}
628
628
},
629
629
@@ -656,7 +656,7 @@ impl @counter {
656
656
if _type == @bool {
657
657
-> return self != 0
658
658
} else {
659
- error "Cannot convert counter to " + _type as @string + " (counter can convert to a number using the counter.to_const macro)"
659
+ throw "Cannot convert counter to " + _type as @string + " (counter can convert to a number using the counter.to_const macro)"
660
660
}
661
661
}
662
662
}
0 commit comments