mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
feat: add ECONNREFUSED error code constant to AxiosError (#10680)
Adds `AxiosError.ECONNREFUSED` as a typed constant alongside existing error codes like ECONNABORTED and ETIMEDOUT, enabling type-safe error code checks without hardcoding strings. Closes #6485 Co-authored-by: marcosnocetti <marcos.nocetti@ubots.com.br> Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
@@ -162,6 +162,7 @@ declare class AxiosError<T = unknown, D = any> extends Error {
|
||||
static readonly ERR_CANCELED = 'ERR_CANCELED';
|
||||
static readonly ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
||||
static readonly ECONNABORTED = 'ECONNABORTED';
|
||||
static readonly ECONNREFUSED = 'ECONNREFUSED';
|
||||
static readonly ETIMEDOUT = 'ETIMEDOUT';
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -519,6 +519,7 @@ export class AxiosError<T = unknown, D = any> extends Error {
|
||||
static readonly ERR_CANCELED = 'ERR_CANCELED';
|
||||
static readonly ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
||||
static readonly ECONNABORTED = 'ECONNABORTED';
|
||||
static readonly ECONNREFUSED = 'ECONNREFUSED';
|
||||
static readonly ETIMEDOUT = 'ETIMEDOUT';
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
||||
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
||||
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
||||
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
||||
AxiosError.ECONNREFUSED = 'ECONNREFUSED';
|
||||
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
||||
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
||||
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
||||
|
||||
Reference in New Issue
Block a user