mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-01 01:25:45 -04:00
Fix: incorrect radius error handling
This commit is contained in:
parent
8e72d6f534
commit
573f158f7f
@ -759,29 +759,19 @@ class Monitor extends BeanModel {
|
|||||||
port = this.port;
|
port = this.port;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
const resp = await radius(
|
||||||
const resp = await radius(
|
this.hostname,
|
||||||
this.hostname,
|
this.radiusUsername,
|
||||||
this.radiusUsername,
|
this.radiusPassword,
|
||||||
this.radiusPassword,
|
this.radiusCalledStationId,
|
||||||
this.radiusCalledStationId,
|
this.radiusCallingStationId,
|
||||||
this.radiusCallingStationId,
|
this.radiusSecret,
|
||||||
this.radiusSecret,
|
port,
|
||||||
port,
|
this.interval * 1000 * 0.4,
|
||||||
this.interval * 1000 * 0.8,
|
);
|
||||||
);
|
|
||||||
if (resp.code) {
|
bean.msg = resp.code;
|
||||||
bean.msg = resp.code;
|
bean.status = UP;
|
||||||
}
|
|
||||||
bean.status = UP;
|
|
||||||
} catch (error) {
|
|
||||||
bean.status = DOWN;
|
|
||||||
if (error.response?.code) {
|
|
||||||
bean.msg = error.response.code;
|
|
||||||
} else {
|
|
||||||
bean.msg = error.message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bean.ping = dayjs().valueOf() - startTime;
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
} else if (this.type === "redis") {
|
} else if (this.type === "redis") {
|
||||||
let startTime = dayjs().valueOf();
|
let startTime = dayjs().valueOf();
|
||||||
|
@ -486,6 +486,7 @@ exports.radius = function (
|
|||||||
host: hostname,
|
host: hostname,
|
||||||
hostPort: port,
|
hostPort: port,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
|
retries: 1,
|
||||||
dictionaries: [ file ],
|
dictionaries: [ file ],
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -497,6 +498,12 @@ exports.radius = function (
|
|||||||
[ attributes.CALLING_STATION_ID, callingStationId ],
|
[ attributes.CALLING_STATION_ID, callingStationId ],
|
||||||
[ attributes.CALLED_STATION_ID, calledStationId ],
|
[ attributes.CALLED_STATION_ID, calledStationId ],
|
||||||
],
|
],
|
||||||
|
}).catch((error) => {
|
||||||
|
if (error.response?.code) {
|
||||||
|
throw Error(error.response.code);
|
||||||
|
} else {
|
||||||
|
throw Error(error.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user