mirror of
https://gitlab.com/RemixDev/deezer-js.git
synced 2024-12-28 02:16:18 +00:00
Fixed recursion in api calls
This commit is contained in:
parent
ad5e45f72e
commit
97231d29d3
|
@ -49,8 +49,10 @@ class API{
|
|||
}).json()
|
||||
} catch (e) {
|
||||
console.debug("[ERROR] deezer.api", method, args, e.name, e.message)
|
||||
// await new Promise(r => setTimeout(r, 2000)) // sleep(2000ms)
|
||||
// return this.api_call(method, args)
|
||||
if (["ECONNABORTED", "ECONNREFUSED", "ECONNRESET", "ENETRESET", "ETIMEDOUT"].includes(e.code)){
|
||||
await new Promise(r => setTimeout(r, 2000)) // sleep(2000ms)
|
||||
return this.api_call(method, args)
|
||||
}
|
||||
throw new APIError(`${method} ${args}:: ${e.name}: ${e.message}`)
|
||||
}
|
||||
if (result_json.error){
|
||||
|
|
|
@ -64,8 +64,10 @@ class GW{
|
|||
}).json()
|
||||
}catch (e){
|
||||
console.debug("[ERROR] deezer.gw", method, args, e.name, e.message)
|
||||
// await new Promise(r => setTimeout(r, 2000)) // sleep(2000ms)
|
||||
// return this.api_call(method, args, params)
|
||||
if (["ECONNABORTED", "ECONNREFUSED", "ECONNRESET", "ENETRESET", "ETIMEDOUT"].includes(e.code)){
|
||||
await new Promise(r => setTimeout(r, 2000)) // sleep(2000ms)
|
||||
return this.api_call(method, args)
|
||||
}
|
||||
throw new GWAPIError(`${method} ${args}:: ${e.name}: ${e.message}`)
|
||||
}
|
||||
if (result_json.error.length) throw new GWAPIError(result_json.error)
|
||||
|
|
Loading…
Reference in a new issue