Skip to content

Commit

Permalink
feat(deps): upgrade axios and typescript (#288 by @jeremyadavis)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: upgrades axios to latest version [with some breaking changes](https://github.com/axios/axios/blob/main/CHANGELOG.md) (shouldn't have an effect on most projects but we are releasing as a breaking change to be safe)
  • Loading branch information
jeremyadavis committed Mar 8, 2023
1 parent abfba3a commit a1ae536
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/apisauce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const CANCEL_ERROR = 'CANCEL_ERROR'

const TIMEOUT_ERROR_CODES = ['ECONNABORTED']
const NODEJS_CONNECTION_ERROR_CODES = ['ENOTFOUND', 'ECONNREFUSED', 'ECONNRESET']
const STATUS_ERROR_CODES = ['ERR_BAD_REQUEST', 'ERR_BAD_RESPONSE']
const in200s = (n: number): boolean => isWithin(200, 299, n)
const in400s = (n: number): boolean => isWithin(400, 499, n)
const in500s = (n: number): boolean => isWithin(500, 599, n)
Expand All @@ -84,6 +85,7 @@ export const getProblemFromError = error => {

// then check the specific error code
if (!error.code) return getProblemFromStatus(error.response ? error.response.status : null)
if (STATUS_ERROR_CODES.includes(error.code)) return getProblemFromStatus(error.response.status)
if (TIMEOUT_ERROR_CODES.includes(error.code)) return TIMEOUT_ERROR
if (NODEJS_CONNECTION_ERROR_CODES.includes(error.code)) return CONNECTION_ERROR
return UNKNOWN_ERROR
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
]
},
"dependencies": {
"axios": "^0.21.4"
"axios": "^0.27.2"
},
"description": "Axios + standardized errors + request/response transforms.",
"devDependencies": {
Expand Down Expand Up @@ -41,7 +41,7 @@
"tslint": "^5.12.0",
"tslint-config-prettier": "^1.17.0",
"tslint-config-standard": "^8.0.1",
"typescript": "3.2.1"
"typescript": "3.5.1"
},
"files": [
"dist/apisauce.js",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"target": "es5",
"module": "es2015",
"strict": false,
"lib": ["es2015"]
"lib": ["dom", "es2015"]
},
"include": ["lib"]
}

0 comments on commit a1ae536

Please sign in to comment.