standardize error messages

This commit is contained in:
bignutty 2024-12-26 23:17:46 +01:00
parent 295072d388
commit e523b5402e
4 changed files with 15 additions and 11 deletions

View file

@ -1,3 +1,4 @@
const { icon } = require('#utils/markdown')
const superagent = require('superagent')
const MAINTOWER_BASE_URL = process.env.MAINTOWER_URL
@ -5,6 +6,10 @@ const MAINTOWER_BASE_URL = process.env.MAINTOWER_URL
let maintowerClient = "1fepg2wdk-prod"
if(process.env.MAINTOWER_OVERRIDE) maintowerClient = process.env.MAINTOWER_OVERRIDE
module.exports.formatErrorMessage = (sev = 0, code, content) => {
return `${icon("webhook_exclaim_" + parseInt(sev))} \`[${Date.now()}]\` @ \`[${process.env.HOSTNAME}]\` **\` ${code} \`** | ${content}`
}
module.exports.maintower = async function (packages, type){
if(!MAINTOWER_BASE_URL) { console.warn("No maintower url configured."); return; }
try{