How to catch and handle global exceptions and errors in vuejs2.0 and submit them to the background

now there is a requirement that you need to catch page errors or failed data requests and submit them to the background for logging. How do you do this?

Apr.03,2021

learn about global error handling and component error handling:
https://cn.vuejs.org/v2/api/-sharperrorHandler
https://cn.vuejs.org/v2/api/-sharperrorCaptured

data requests fail to be submitted to the server, which you have to consider, especially if the client logging service and the data request service are at the same endpoint. For more information on how to intercept data request errors, please refer to the http component you rely on, such as axios . Slice:

// Add a request interceptor
axios.interceptors.request.use(function (config) {
    // Do something before request is sent
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });

// Add a response interceptor
axios.interceptors.response.use(function (response) {
    // Do something with response data
    return response;
  }, function (error) {
    // Do something with response error
    return Promise.reject(error);
  });
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e87b86-e7f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e87b86-e7f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?