catch errors

This commit is contained in:
MathMan05 2024-07-30 15:38:40 -05:00
parent 7009138be5
commit ed2bc49b0c
2 changed files with 17 additions and 5 deletions

View file

@ -5,10 +5,16 @@ class Permissions {
hasDeny;
constructor(allow, deny = "") {
this.hasDeny = !!deny;
console.log(allow,deny);
try {
this.allow = BigInt(allow);
this.deny = BigInt(deny);
}
catch (e) {
this.allow = 0n;
this.deny = 0n;
console.error(`Something really stupid happened with a permission with allow being ${allow} and deny being, ${deny}, execution will still happen, but something really stupid happened, please report if you know what caused this.`);
}
}
getPermissionbit(b, big) {
return Boolean((big >> BigInt(b)) & 1n);
}

View file

@ -5,8 +5,14 @@ class Permissions{
readonly hasDeny:boolean;
constructor(allow:string,deny:string=""){
this.hasDeny=!!deny;
this.allow=BigInt(allow);
this.deny=BigInt(deny);
try{
this.allow = BigInt(allow);
this.deny = BigInt(deny);
}catch(e){
this.allow = 0n;
this.deny = 0n;
console.error(`Something really stupid happened with a permission with allow being ${allow} and deny being, ${deny}, execution will still happen, but something really stupid happened, please report if you know what caused this.`)
}
}
getPermissionbit(b:number,big:bigint) : boolean{
return Boolean((big>>BigInt(b))&1n);