mirror of
https://github.com/koichixD/uptime-kuma.git
synced 2026-09-04 17:23:21 +00:00
fix: improve RADIUS client error handling and socket cleanup (#6783)
Co-authored-by: GitTensor Miner <miner@gittensor.io> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
GitTensor Miner
autofix-ci[bot]
parent
a38c6dea25
commit
236d74238c
+12
-2
@@ -356,10 +356,20 @@ exports.radius = function (
|
||||
],
|
||||
})
|
||||
.catch((error) => {
|
||||
// Preserve error stack trace and provide better context
|
||||
if (error.response?.code) {
|
||||
throw Error(error.response.code);
|
||||
const radiusError = new Error(`RADIUS ${error.response.code} from ${hostname}:${port}`);
|
||||
radiusError.response = error.response;
|
||||
radiusError.originalError = error;
|
||||
throw radiusError;
|
||||
} else {
|
||||
throw Error(error.message);
|
||||
// Preserve original error message and stack trace
|
||||
const enhancedError = new Error(
|
||||
`RADIUS authentication failed for ${hostname}:${port}: ${error.message}`
|
||||
);
|
||||
enhancedError.originalError = error;
|
||||
enhancedError.stack = error.stack || enhancedError.stack;
|
||||
throw enhancedError;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user