@rethinking-studio/clawcontrol 1.0.1 → 1.0.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/index.ts +10 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -106,8 +106,16 @@ const clawcontrolOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
if (!createRes.ok) {
|
|
109
|
-
const
|
|
110
|
-
|
|
109
|
+
const errText = await createRes.text();
|
|
110
|
+
let errMsg = errText;
|
|
111
|
+
try {
|
|
112
|
+
const parsed = JSON.parse(errText);
|
|
113
|
+
if (parsed.details) errMsg = `${parsed.error}: ${parsed.details}`;
|
|
114
|
+
else if (parsed.error) errMsg = parsed.error;
|
|
115
|
+
} catch {
|
|
116
|
+
/* use raw text */
|
|
117
|
+
}
|
|
118
|
+
throw new Error(`Failed to create pairing token: ${errMsg}`);
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
const { pairingToken, expiresIn } = (await createRes.json()) as { pairingToken: string; expiresIn: number };
|