OS5 can be pretty tricky. Generally my approach has been a lot of custom logging, avoiding alert, and instead setting up a custom <div> where I update the innerHTML with a log of messages.
Wrapping every function in a try/catch block has also helped narrow down issues for me in conjunction with the logging above.
Beyond that, logging actions as they occur (i.e. "Loading database.", "Database loaded.", "Initializing app.", etc.) to see exactly how far and "what" is executing has also been a big part of my OS5 debugging.
Basically try/catch and logging as much as possible would be my recommendation. Perhaps other members have their own suggestions.