简体   繁体   中英

what is the best way to debug and find errors in a total.js app like the eshop provided on their website?

I have been following everything the total.js documentations have to offer to be able to work with the eshop project. however, sometimes i get errors and the only thing i see is 404 on the browser whether the error is from api or frontend or routing, so at this point, tracing errors feels virtually impossible and taking too much time.

is there any way i can get comprehensive error messages to be able to figure out what went wrong or which file to look at?

You have several possibilities how to debug :

  • you can add your custom logs
  • check output logs
  • or catch 404 errors globally:
// The route will be evaluated if the page won't exist
ROUTE('#404', function() {
    var self = this;

    // Here you can found info about the URL
    console.log(404, self.url);

    self.status = 404;
    self.plain('404: Page not found');
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM