Skip to content

Commit

Permalink
fix: Add error types to SDK (#2797)
Browse files Browse the repository at this point in the history
* Fix type errors

This returns all errors as a type from Unkey versus just one

* Adding changeset

* [autofix.ci] apply automated fixes

---------

Co-authored-by: James Perkins <jamesperkins@Jamess-MacBook-Air.local>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 9, 2025
1 parent 7664efc commit 0746b33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twelve-kiwis-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@unkey/api": minor
---

Add the types for error codes
8 changes: 7 additions & 1 deletion packages/api/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@ import type { paths } from "./openapi";

// this is what a json body response looks like
export type ErrorResponse =
paths["/v1/liveness"]["get"]["responses"]["500"]["content"]["application/json"];
| paths["/v1/liveness"]["get"]["responses"]["400"]["content"]["application/json"]
| paths["/v1/liveness"]["get"]["responses"]["401"]["content"]["application/json"]
| paths["/v1/liveness"]["get"]["responses"]["403"]["content"]["application/json"]
| paths["/v1/liveness"]["get"]["responses"]["404"]["content"]["application/json"]
| paths["/v1/liveness"]["get"]["responses"]["409"]["content"]["application/json"]
| paths["/v1/liveness"]["get"]["responses"]["429"]["content"]["application/json"]
| paths["/v1/liveness"]["get"]["responses"]["500"]["content"]["application/json"];

0 comments on commit 0746b33

Please sign in to comment.