Hi,
I have a watch face with code that works perfectly in the simulator and perfectly on the watch for generally at least a day, but then fails catastrophically at unpredictable intervals with messages like this one:
ERROR: Unhandled Exception DETAILS: NONE STORE_ID: CALLSTACK: UnexpectedTypeException: Expected an object of type Time.Duration native function
Obviously, I am now reviewing everywhere I use Time.Duration, but I frankly cannot find any possibility for it either being a) something other than a Time.Duration or b) being null.
I found just three places:
// Reads last temporal and finds earliest it can call hidden function setTemporalCallTime() { var earliest = Background.getLastTemporalEventTime(); if(earliest == null) { nextCallTime = Time.now(); } else { nextCallTime = earliest.add(new Time.Duration(300)); } }
Or this:
Background.registerForTemporalEvent(new Time.Duration(300));
Or this:
var tillNow = new Time.Duration(difference); iterator = Toybox.SensorHistory.getHeartRateHistory({ :period=>tillNow });
In none of them can I see a reason to explain the nasty, unrecoverable error.
Is this likely to be a Firmware specific bug (I'm on 735xt running 9.80) or is there some arcane null check that I need to implement?
G