@agentvalet/register 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -874,9 +874,18 @@ async function callCliAuth(body) {
|
|
|
874
874
|
},
|
|
875
875
|
body: JSON.stringify(body)
|
|
876
876
|
});
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
877
|
+
const text = await res.text();
|
|
878
|
+
let json = null;
|
|
879
|
+
try {
|
|
880
|
+
json = text ? JSON.parse(text) : null;
|
|
881
|
+
} catch {
|
|
882
|
+
}
|
|
883
|
+
if (!res.ok) {
|
|
884
|
+
const err = json?.error ?? text ?? `HTTP ${res.status}`;
|
|
885
|
+
const detail = json?.detail ?? "";
|
|
886
|
+
throw new Error(detail ? `${err}: ${detail}` : err);
|
|
887
|
+
}
|
|
888
|
+
return json ?? {};
|
|
880
889
|
}
|
|
881
890
|
async function browserLogin() {
|
|
882
891
|
const state = crypto.randomUUID();
|