{"id":16593139,"url":"https://github.com/aminfazlmondo/axios-error-redact","last_synced_at":"2026-06-26T04:01:07.815Z","repository":{"id":37050862,"uuid":"379799361","full_name":"AminFazlMondo/Axios-Error-Redact","owner":"AminFazlMondo","description":"Library to redact sensitive information from Axios errors","archived":false,"fork":false,"pushed_at":"2026-04-11T01:45:05.000Z","size":3874,"stargazers_count":4,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-11T03:25:43.117Z","etag":null,"topics":["axios","error-handling","hacktoberfest","interceptor","javascript","nodejs","projen","redact","security","sensitive"],"latest_commit_sha":null,"homepage":"https://aminfazlmondo.github.io/Axios-Error-Redact/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AminFazlMondo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-06-24T04:06:48.000Z","updated_at":"2026-04-09T01:30:40.000Z","dependencies_parsed_at":"2024-02-27T01:45:54.595Z","dependency_job_id":"3ba793cc-c02e-4b37-84bf-ee0db9709189","html_url":"https://github.com/AminFazlMondo/Axios-Error-Redact","commit_stats":null,"previous_names":[],"tags_count":1036,"template":false,"template_full_name":null,"purl":"pkg:github/AminFazlMondo/Axios-Error-Redact","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AminFazlMondo%2FAxios-Error-Redact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AminFazlMondo%2FAxios-Error-Redact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AminFazlMondo%2FAxios-Error-Redact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AminFazlMondo%2FAxios-Error-Redact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AminFazlMondo","download_url":"https://codeload.github.com/AminFazlMondo/Axios-Error-Redact/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AminFazlMondo%2FAxios-Error-Redact/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31785681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axios","error-handling","hacktoberfest","interceptor","javascript","nodejs","projen","redact","security","sensitive"],"created_at":"2024-10-11T23:23:55.196Z","updated_at":"2026-04-14T07:00:42.331Z","avatar_url":"https://github.com/AminFazlMondo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Axios-Error-Redact\n\nLibrary to redact sensitive information from Axios errors.\nThis can be used as an response interceptor for axios instances, or can be used standalone.\n\n# Compatibility\n\nWorks with\n\n- `axios@^0`\n- `axios@^1`\n\n# Getting started\n\n```console\nnpm i axios-error-redact\n```\n\n## Interceptor usage\n\n### Simple Interceptor\n\nThe redactor can simply be used in an interceptor to extract non-sensitive data from error and continue\n\n```javascript\nimport axios from 'axios'\nimport {createErrorInterceptor} from 'axios-error-redact'\n\nconst instance = axios.create({baseURL: 'http://example.com'})\n\ninstance.interceptors.response.use(undefined, createErrorInterceptor())\n\ntry {\n  await instance.get()\n} catch(error) {\n  // The isHttpErrorResponse helper can be used to ensure the thrown error is a redacted error\n  if (isHttpErrorResponse(error)) {\n    console.error(error.response.statusMessage, error.message)\n  }\n}\n\n\n```\n\n### Custom Interceptor\n\nThe redactor can be used in an interceptor to extract non-sensitive data from error and continue, with this approach the interceptor can be created with some custom logic\n\n```javascript\nimport axios from 'axios'\nimport {AxiosErrorRedactor} from 'axios-error-redact'\n\nconst instance = axios.create({baseURL: 'http://example.com'})\n\nconst redactor = new AxiosErrorRedactor()\n\nfunction errorInterceptor(error: any): any {\n  const redactedError = redactor.redactError(error)\n  // You may want to add more logic here; for example logging\n  return Promise.reject(redactedError)\n}\n\ninstance.interceptors.response.use(undefined, errorInterceptor)\n\n// instance.get()\n\n```\n\n## Standalone usage\n\nThe library can be used on its own without using any interceptor as well.\n\n```javascript\nimport axios from 'axios'\nimport {AxiosErrorRedactor} from 'axios-error-redact'\n\nconst redactor = new AxiosErrorRedactor()\n\nconst result = axios.get('http://example.com')\n  .catch(error =\u003e redactor.redactError(error))\n\n```\n\n## API\n\n### Constructor\n\nThe redactor is initialized with some defaults; in which all of the sensitive data will be redacted (request, response, query)\n\n```javascript\nimport {AxiosErrorRedactor} from 'axios-error-redact'\n\nconst redactor = new AxiosErrorRedactor()\n\n```\n\nThe constructor also accepts options to enable or disable these\n\n```javascript\nimport {AxiosErrorRedactor} from 'axios-error-redact'\n\nconst redactor = new AxiosErrorRedactor({\n  redactRequestDataEnabled: false,\n  redactResponseDataEnabled: false,\n  redactQueryDataEnabled: false,\n})\n\n```\n\n### Main Function\n\nThe main function that can be called on the initiated object is `redactError` which accepts the error as the input and returns the redacted information in an object of type `HttpErrorResponse`\n\n```javascript\nimport axios from 'axios'\nimport {AxiosErrorRedactor} from 'axios-error-redact'\n\nconst redactor = new AxiosErrorRedactor()\n\nconst result = axios.get('http://example.com')\n  .catch(error =\u003e redactor.redactError(error))\n\n```\n\n### Changing Flags\n\nThere are three functions that can be used and chained after the initiated object in order to change what sort of data should be skipped to be redacted.\n\n```javascript\nimport {AxiosErrorRedactor} from 'axios-error-redact'\n\nconst redactor = new AxiosErrorRedactor()\n  .skipRequestData()\n  .skipQueryData()\n\n```\n\n### Response\n\nThe redact library will extract information from axios error and return an object with following details.\n\n```javascript\nHttpErrorResponse {\n  isErrorRedactedResponse: true;\n  message: string;\n  fullURL: string;\n  response: {\n    statusCode?: number;\n    statusMessage: string;\n    data: any;\n  };\n  request: {\n    baseURL: string;\n    path: string;\n    method: string;\n    data: any;\n  };\n}\n```\n\nIf the error is not an axios error, then the same error will be returned.\n\n### Type guard\n\nThe `isHttpErrorResponse()` function can be used as a type guard in TypeScript to narrow the error type.\n\nThis can be useful when multiple error types can be thrown from the try block.\n\nBe sure not to use the `isAxiosError()` type guard provided by Axios since all intercepted Axios errors will be transformed into a `HttpErrorResponse`\n\n```typescript\ntry {\n  ...\n} catch(error: unknown) {\n  if (isHttpErrorResponse(error)) {\n    // error is narrowed to type HttpErrorResponse\n  }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminfazlmondo%2Faxios-error-redact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faminfazlmondo%2Faxios-error-redact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminfazlmondo%2Faxios-error-redact/lists"}