axios.get('/user/12345')
.catch(function (error) {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log(error.response.data); // 取得內容,用 error.response.data
console.log(error.response.status); // 取得狀態碼,用 error.response.status
console.log(error.response.headers); // 取得表頭,用 error.response.headers
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
}
console.log(error.config);
});
Support Form: 主要的官方支援,The “official” support venue. Report “something is down” here. Feature requests likely to get a canned “we’ll consider it, but no promises” response.
Google Groups: 主要是成員討論,Active involvement by the core team with the usual caveats about turnaround time in group-oriented mail systems. Best place for highly technical discussions about app internals and “weird” issues.
StackOverflow: 疑難雜症,Slow/unpredictable response times but best place for backup reference material. If you’ve read a Q&A on StackOverflow, you know the type of question that’s best to post there, too.
該用兩個 reference 就用,不要想說用他們共通的父節點來存取,這樣沒有比較省。If you need to reference an object from two different places, take two refs to it.
姚可儀是獨立記者,也是 CIA 特務,他為了找到自己的妹妹,穿梭於菲律賓紅燈區。後來他找到自己的妹妹了,但妹妹已經死了。為了復仇,他決心找出這個擄人的犯罪集團。幾次追查下來,他跟同事已經駭進了犯罪集團的電腦,但還來不及下載更多資訊,只能先加密犯罪集團的資料庫。犯罪集團無法解鎖,只能追殺姚可儀以及他的同事,想取得他們的加密金鑰,以解開被加密的資料庫。