Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).catch((error) => {
if (axios.isCancel(error)) {
console.log(error.message);
} else {
mock.restore(); //// JUST FOR MOCKING
dispatch({ type: types.FETCH_GROUPS_ERROR, error: error.response.data });
}
});
};
}, error => {
let message = '';
if(axios.isCancel(error)) {
source.cancel('ๅๆถ็ฝ็ป่ฏทๆฑ')
}
// ๆๅบ้่ฏฏ
if(error && error.response){
let { response } = error,
{ status, data, config: responseConfig } = response,
{ method: methodType } = responseConfig;
switch(status){
//้่ฏฏ็่ฏทๆฑ
case '400':
message = `400:${ methodType }:ๆๅกๅจไธ็่งฃ่ฏทๆฑ็่ฏญๆณ`;
break;
case '403':
message = `403:${ methodType }:ๆๅกๅจๆ็ป่ฏทๆฑ`;
break;
//้กต้ขไธขๅคฑ
var convertResponse = curry(function (startedAt, axiosResult) {
var end = toNumber(new Date());
var duration = end - startedAt;
// new in Axios 0.13 -- some data could be buried 1 level now
var isError = axiosResult instanceof Error || axios.isCancel(axiosResult);
var axiosResponse = axiosResult;
var axiosError = axiosResult;
var response = isError ? axiosError.response : axiosResponse;
var status = (response && response.status) || null;
var problem = isError
? getProblemFromError(axiosResult)
: getProblemFromStatus(status);
var originalError = isError
? axiosError
: null;
var ok = in200s(status);
var config = axiosResult.config || null;
var headers = (response && response.headers) || null;
var data = (response && response.data) || null;
// give an opportunity for anything to the response transforms to change stuff along the way
var transformedResponse = {
}).catch(function (e) {
Notify.unblockUI();
if (Axios.isCancel(e)) {
// run in background
return
}
Notify.error(this.$gettext("Indexing failed"));
ctx.busy = false;
ctx.completed = 0;
ctx.fileName = '';
});
},
.catch(error => {
if (axios.isCancel(error)) return;
this.tracerApiSource = null;
this.setState({ building: false });
this.handleError(error);
});
} else {
(error: AxiosError) => {
onApiCallFinish(error.config.apiCallId);
if (!axios.isCancel(error)) {
onError(error);
throw error;
}
}
);
private handleRequestError = (error: AxiosError) => {
const {path: url} = this.options
if (axios.isCancel(error)) {
throw new CancelError()
}
if (error.response) {
throw new RequestError({
headers: error.config.headers,
url: error.config.url || url,
}, {
status: error.response.status,
statusText: error.response.statusText,
})
}
throw error
}
const filter: API.GlobalLogFilter = {
author: this.state.author,
branch: this.state.branch,
from: this.state.from,
till: this.state.till,
all: this.state.all,
};
try {
this.setState({ loading: true });
this.cts = axios.CancelToken.source();
const data = await API.getGlobalLog(filter, { cancelToken: this.cts.token });
this.setState({ data, loading: false });
onLoaded();
} catch (error) {
this.setState({ loading: false });
if (axios.isCancel(error)) {
onLoaded();
} else {
onError(error);
}
}
}
}).then((val) => {
if(axios.isCancel(val)) return false;
this.props.onLoadingStateChange(false);
});
return requestPromise;
.catch((err: Error) => {
if (axios.isCancel(err)) {
throw new RequestCanceledError(err.message)
} else {
throw err
}
})
.then((resp: AxiosResponse) => {