Skip to content

Update ngl-message-bot.js#1

Open
Rednexie wants to merge 1 commit intoLegacyVaper:mainfrom
Rednexie:patch-1
Open

Update ngl-message-bot.js#1
Rednexie wants to merge 1 commit intoLegacyVaper:mainfrom
Rednexie:patch-1

Conversation

@Rednexie
Copy link

the file wpuld quit in case of an error, since formattedDate was declared inside the try block with const, so catch block is unable to access it.

the output would be:

        **console.error(`[${formattedDate}] [Err] ${error}`);
                          ^

ReferenceError: formattedDate is not defined**

i moved the declaration of the variable, outside the try block. it should be accesible from the catch now.
another option could be using the 'var' keyword, but this would overwrite the variable.

good luck with node.js and programming. i suggest you to pay more attention to codeblocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant