Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: explicitly show error messages #63

Merged

Conversation

xayanide
Copy link
Contributor

@xayanide xayanide commented Apr 29, 2022

Description
Usually, when there are errors, IRC client error event triggers log4js, logs them like this:

[14:16:14.613][ERROR] irc - ERROR: {}

{} alone is not really helpful.
Like what was shown in issue #23

So, I added these 2 expressions as failsafes for this.

JSON.stringify(message.stack) for errors that needs to be converted into JSON like objects or values.

message.stack alone for errors that do not need to be converted into JSON.

Then be able to trace where the error had occured, not just the error message alone. In just a single template literal.

Also through this, the end user should be able to send informative error stacks in their issue's descriptions.

Example error:

[14:16:14.613][ERROR] irc - ERROR:
// JSON.stringify(message)
{} 
// JSON.stringify(message.stack)
"TypeError: Example is not a constructor\n    at Object.GetObject 
// long error stack here
(C:\\Users\\User\\Desktop\\osu-ahr\\dist\\cli\\index.js
// message
TypeError: Example is not a constructor
// message.stack
TypeError: Example is not a constructor
    // long error stack here
    at Object.GetObject (C:\Users\User\Desktop\osu-ahr\src\Example.js:0:0) 

If any, suggest changes on how can this be implemented better.

@Meowhal Meowhal merged commit 9273b56 into Meowhal:master Apr 30, 2022
@xayanide xayanide deleted the master-refactor-explicitly-show-error-messages branch April 30, 2022 08:44
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.

2 participants