gologin 2.0.17 → 2.0.18
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/package.json +1 -1
- package/src/gologin.js +11 -0
package/package.json
CHANGED
package/src/gologin.js
CHANGED
|
@@ -151,6 +151,17 @@ export class GoLogin {
|
|
|
151
151
|
|
|
152
152
|
debug('profileResponse', profileResponse.statusCode, profileResponse.body);
|
|
153
153
|
|
|
154
|
+
const { body: errorBody = '' } = profileResponse;
|
|
155
|
+
const backendErrorHeader = 'backend@error::';
|
|
156
|
+
if (errorBody.includes(backendErrorHeader)) {
|
|
157
|
+
const errorData =
|
|
158
|
+
errorBody
|
|
159
|
+
.replace(backendErrorHeader, '')
|
|
160
|
+
.slice(1, -1);
|
|
161
|
+
|
|
162
|
+
throw new Error(errorData);
|
|
163
|
+
}
|
|
164
|
+
|
|
154
165
|
if (profileResponse.statusCode === 404) {
|
|
155
166
|
throw new Error(JSON.parse(profileResponse.body).message);
|
|
156
167
|
}
|