mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 13:43:06 -04:00
Error logging
This commit is contained in:
parent
ec2ec39e25
commit
c88f05a2b9
2 changed files with 72 additions and 10 deletions
22
labscore/logging.js
Normal file
22
labscore/logging.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const superagent = require('superagent')
|
||||
|
||||
const MAINTOWER_BASE_URL = `https://labscore-v2.vercel.app/maintower/`
|
||||
|
||||
let maintowerClient = "1fepg2wdk-prod"
|
||||
if(process.env.MAINTOWER_OVERRIDE) maintowerClient = process.env.MAINTOWER_OVERRIDE
|
||||
|
||||
module.exports.maintower = async function (packages, type){
|
||||
try{
|
||||
let res = await superagent.post(MAINTOWER_BASE_URL + 'invoke')
|
||||
.query({
|
||||
client: maintowerClient,
|
||||
type: type
|
||||
})
|
||||
.send(packages)
|
||||
if(res.body.status == 0) return res.body.id;
|
||||
throw res.body.message
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
throw "Maintower request failed."
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue