Closed dominikbraun closed 3 years ago
Hi, I would like to do this one.
I think handling the error before we access the End
property of the Record
struct will do.
Potentially, adding this if block in the corresponding if-else
blocks.:
if record.End == nil {
return errors.New("record is still in progress")
}
Also, do you think, we should extract the contents of the if-else
blocks into a local function? Since both are doing the same things essentially.
https://github.com/dominikbraun/timetrace/blob/9558282d72fdea96b456cc6a04c5667f96a18de5/core/record.go#L125-L142
if
block should be sufficient.
Currently, running
go run . edit record
will panic in case the latest record has not been stopped yet - because in that case, the record'sEnd
field isnil
. Editing a record using the--plus
and--minus
options should not be allowed if the latest record has no end yet.