when I execute this code, I expected to get a "fal...
# announcements
m
when I execute this code, I expected to get a "false" but instead, I always get true. Not sure what I am doing wrong.
Copy code
metrics.timer(timerName, successTag).time {
                throw IllegalArgumentException("Stop")`
s
are you actually calling
toTime()
in your real code
line 16 in your snippet @marcelo
m
figured I would by just me adding things like:
Copy code
metrics.timer(timerName, successTag).time {
                "Test".capitalize()            }
figured that this would take the block of code, no?
😕
s
right but in the implementation of
Timer1.time()
it looks like you’re accepting a block but never actually executing it
you just have
Copy code
try {
  toTime
sans
()
👍 1
maybe you just omitted them when transposing to slack, but I figured it’s worth asking just in case you accidentally omitted them in your actual code
m
Dude!!
🐑 feel so sheepish
thanks
👍 1
s
lmao no worries, we all make silly mistakes from time to time
the IDE should warning highlight it though with
The expression is unused
though I guess that’s maybe kind of a vague warning when you’re intentionally not using the return value of the lambda in question
also maybe consider making this an
inline
fun to reduce overhead, but I suppose it shouldn’t matter if you’re just comparing runs against each other
m
thanks Shawn, just a bit shy of a month using Kotlin. Really liking it but I haven't seen the coroutines yet. I will look into it. What's the best place to get info - Kotlin docs?
s
Kotlin docs are comprehensive and a great place to start
👍 1
Stackoverflow is where I go if I can’t find an answer in the docs