Skip to content

Misleading error message which can cause trouble in debugging #115

@YashKumarVerma

Description

@YashKumarVerma

try {
const prikeyPath = './keys/key';
if (fs.existsSync(prikeyPath)) {
PRIKEY = fs.readFileSync(prikeyPath, 'utf8');
} else {
if (DISABLE_SEC || ENABLE_SECURITY_AT && Date.parse(ENABLE_SECURITY_AT) > Date.now()) {
PRIKEY = '';
console.warn('prikey null since DISABLE_SEC and no prikey provided');
} else {
console.error('prikey does not exist');
}
}
} catch (err) {
console.error(err);
}
try {
const pubkeyPath = './keys/key.pub';
if (fs.existsSync(pubkeyPath)) {
var PUBKEY = fs.readFileSync(pubkeyPath, 'utf8');
} else {
if (DISABLE_SEC || ENABLE_SECURITY_AT && Date.parse(ENABLE_SECURITY_AT) > Date.now()) {
PUBKEY = '';
console.warn('pubkey null since DISABLE_SEC and no pubkey provided');
} else {
console.error('pubkey does not exist');
}
}
} catch (err) {
console.error(err);
}

The code block on line 40 and 56 are triggered when DISABLE_SEC || ENABLE_SECURITY_AT && Date.parse(ENABLE_SECURITY_AT) > Date.now() turns false. This has no relation to the files being present or not, whereas the block logs out a message saying XXX does not exist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions