mirror of
https://github.com/stoatchat/javascript-client-api.git
synced 2026-07-15 14:15:37 -04:00
chore: handle non-2xx as error
This commit is contained in:
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "revolt-api",
|
||||
"version": "0.8.6",
|
||||
"version": "0.8.6-1",
|
||||
"description": "Revolt API Library",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
@@ -16,7 +16,7 @@
|
||||
"prepublish": "in-publish && pnpm build || echo Skipping build."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@insertish/oapi": "0.2.4",
|
||||
"@insertish/oapi": "0.2.5",
|
||||
"in-publish": "^2.0.1",
|
||||
"openapi-typescript": "^5.4.2",
|
||||
"typescript": "^5.8.3"
|
||||
@@ -29,4 +29,4 @@
|
||||
"README.md"
|
||||
],
|
||||
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
||||
}
|
||||
}
|
||||
Generated
+5
-5
@@ -9,8 +9,8 @@ importers:
|
||||
.:
|
||||
devDependencies:
|
||||
'@insertish/oapi':
|
||||
specifier: 0.2.4
|
||||
version: 0.2.4
|
||||
specifier: 0.2.5
|
||||
version: 0.2.5
|
||||
in-publish:
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1
|
||||
@@ -27,8 +27,8 @@ packages:
|
||||
resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@insertish/oapi@0.2.4':
|
||||
resolution: {integrity: sha512-PSomeEr02QbkH1DGBOr068bmz7rnZlyKclOyf9g6opGTSkEp04es51mfx7+etVfhUqxnyhCGrr4Nu5KENvDBnQ==}
|
||||
'@insertish/oapi@0.2.5':
|
||||
resolution: {integrity: sha512-qepXfQz/jrT2DhvzMYzNzQN9HsuEZkDCPJFbszBuftIahXosmkoxgBHIyxYMCo1yVvBnMnfwSqYJTm9GmJ0JNw==}
|
||||
hasBin: true
|
||||
|
||||
argparse@2.0.1:
|
||||
@@ -88,7 +88,7 @@ snapshots:
|
||||
|
||||
'@fastify/busboy@2.1.1': {}
|
||||
|
||||
'@insertish/oapi@0.2.4':
|
||||
'@insertish/oapi@0.2.5':
|
||||
dependencies:
|
||||
typescript: 4.9.5
|
||||
optionalDependencies:
|
||||
|
||||
+9
-2
@@ -33,7 +33,7 @@ export function getPathName(anyPath: string) {
|
||||
|
||||
const list =
|
||||
(pathResolve as unknown as Record<string, (string | [string])[]>)[
|
||||
(segments.length - 1).toString()
|
||||
(segments.length - 1).toString()
|
||||
] || [];
|
||||
for (const entry of list) {
|
||||
let i = 1;
|
||||
@@ -204,7 +204,14 @@ export class API {
|
||||
} as HeadersInit,
|
||||
body: passbody,
|
||||
});
|
||||
return await fetchdata[config?.responseType || "json"]();
|
||||
|
||||
const data = await fetchdata[config?.responseType || "json"]();
|
||||
|
||||
if (fetchdata.ok) {
|
||||
return data;
|
||||
} else {
|
||||
throw data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user