Soon after I bought it the battery terminals came loose on my old 990 KTM while I was riding it. Dash lights came on and the rev counter needle began swinging wildly to and fro against the stops like a windscreen wiper. But it didn't conk out. I would expect the engine to keep running with loose terminals - but the 990 was an older generation bike and completely analogue, so who knows.
My Triumph Rocket 3 died for no reason a couple of times and lights came on. I coasted to a stop, killed the ignition and restarted it and it fired up immediately. It turned out to be some gearbox or clutch sensor. Not uncommon according to the owner's forum and the dealer sorted it at the next service.
Hopefully Dox's is something similar.
@Dox is it still under warranty?