mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-28 20:40:06 +00:00
Merge pull request #1743 from transloadit/companion-errors
Companion errors
This commit is contained in:
commit
bba0f70ba2
2 changed files with 6 additions and 11 deletions
|
|
@ -30,8 +30,10 @@ module.exports = class Provider extends RequestClient {
|
|||
|
||||
onReceiveResponse (response) {
|
||||
response = super.onReceiveResponse(response)
|
||||
const authenticated = response.status !== 401
|
||||
this.uppy.getPlugin(this.pluginId).setPluginState({ authenticated })
|
||||
const plugin = this.uppy.getPlugin(this.pluginId)
|
||||
const oldAuthenticated = plugin.getPluginState().authenticated
|
||||
const authenticated = oldAuthenticated ? response.status !== 401 : response.status < 400
|
||||
plugin.setPluginState({ authenticated })
|
||||
return response
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ class Drive {
|
|||
.where(where)
|
||||
.auth(options.token)
|
||||
.request((err, resp) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
if (err || resp.statusCode !== 200) {
|
||||
reject(this._error(err, resp))
|
||||
return
|
||||
}
|
||||
resolve(resp)
|
||||
|
|
@ -71,13 +71,6 @@ class Drive {
|
|||
Promise.all([teamDrivesPromise, filesPromise])
|
||||
.then(
|
||||
([teamDrives, filesResponse]) => {
|
||||
if (filesResponse.statusCode !== 200) {
|
||||
const err = this._error(null, filesResponse)
|
||||
logger.error(err, 'provider.drive.list.error')
|
||||
done(err)
|
||||
return
|
||||
}
|
||||
|
||||
const returnData = this.adaptData(
|
||||
filesResponse.body,
|
||||
teamDrives && teamDrives.body,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue