diff --git a/lib/chat/getConversations.js b/lib/chat/getConversations.js index b7614694d..16838706f 100644 --- a/lib/chat/getConversations.js +++ b/lib/chat/getConversations.js @@ -13,7 +13,7 @@ exports.optional = ['jar'] * @example const noblox = require("noblox.js") * // Login using your cookie * const conversations = await noblox.getConversations([1, 2, 3]) -**/ + **/ exports.func = (args) => { const jar = args.jar @@ -28,7 +28,13 @@ exports.func = (args) => { } }).then((res) => { if (res.statusCode !== 200) { - throw new Error('You are not logged in') + const body = JSON.parse(res.body) || {} + if (body.errors && body.errors.length > 0) { + const errors = body.errors.map((e) => { + return e.message + }) + throw new Error(`${res.statusCode} ${errors.join(', ')}`) + } } else { let response = JSON.parse(res.body)