How to solve the problem of Uncaught (in promise)?

problem description

I have no problem writing this on my own computer, but there is a problem in the test. I looked up the information and said to add a catch, but can my request still return the data I want?

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

var jsondata=JSON.stringify(dataInfo);
        this.hide=true;
        this.$http.post(seajs.data.base +"price/calcAmount.do?custId="+this.custId, jsondata, {emulateJSON: false}).then(
            data => {
                if(data.data.code==200){
                    this.total=data.data.data.total;
                    this.postInfo=data.data.data.dataList;
                    console.log(data.data);
                }else{
                    this.$Message.info(data.data.msg);
                    return false;
                }
            }
        ).catch(e){
           console.log(e);
        };

what result do you expect? What is the error message actually seen?

Nov.25,2021

did you write the interface address wrong? http://127.0.0.1?


.catch ((e) = > {});

how did you write it yourself?

.catch (e) {}


try catch is confused with primise's catch.


your problem is not to know the problem of promise reporting an error.
but to know why your computer interface is normal, and it will be 400 on the test side.
this needs to compare the difference between the requests sent by your computer and the browsers on the other side of the test, to modify the code.
this is basically caused by errors in the request URL after deployment, and it is not certain. You need to see the request details


the API is written with a local address. What kind of testing method is used in the test you are talking about?

Menu