Fine tuning error handling

This commit is contained in:
Daniel
2020-04-05 20:06:35 +02:00
parent 188d8430a2
commit caca6995a1

View File

@@ -14,6 +14,7 @@ if (is_jest) { // it's jest
} else { // it's mocha
global.beforeAll = global.before
global.afterAll = global.after
global.test = global.it
}
// lazy-loading chai
@@ -102,7 +103,7 @@ exports.launch = (project, ...args) => {
if (!e.response.data) throw e
if (!e.response.data.error) throw e
const { code, message } = e.response.data.error
throw new Error (`${code} - ${message}`)
throw new Error (code && code !== 'null' ? `${code} - ${message}` : message)
}
return test