zaida04 / guilded.js

A library for creating bots with the guilded.gg bot API.
https://guilded.js.org
MIT License
69 stars 15 forks source link

feat: added verbose logging to errors #210

Closed rkoval closed 1 year ago

rkoval commented 1 year ago

Please describe the changes this PR makes and why it should be merged:

Status

Semantic versioning classification:


Yo! Ryan from Guilded Staff here! :pizza:

First of all, thank you so much for your continued interest in Guilded and its bot API!!! We love seeing the passion in the community for building fun stuff against the product. This library has opened the door to JavaScript and TypeScript devs to be able to write bots quickly in these languages. Nice work there!!

This PR serves to bring this library to conformance with the "Verbose Logging" guildeline in Guilded's Bot Library Guidelines document. We have been having trouble working through various support issues recently in our community server for this library, and I think a lot of the pain points come from missing some details from the "Verbose Logging" [1]. From the brief look I took, it does look like this library conforms to the other guidelines in that doc though, so nice work otherwise!!

Some outstanding issues with this PR that I will hand off to the library maintainers to fix (mostly done in the interest of time, sorry for wall of text!):

I encourage you to prioritize fixing the outstanding issues, merging the PR, and creating a new release so that the Guilded support team can better help debugging various API issues going forward. Please let me know how I can help in facilitating a quick turnaround here.


changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: ba7c9602b335f2f330a74f73fa5c0942a40cee9e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages | Name | Type | | ------------------------- | ----- | | @guildedjs/rest | Major | | @guildedjs/proxy-service | Minor | | guilded.js | Patch | | @guildedjs/webhook-client | Patch | | @guildedjs/gil | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

ItzNxthaniel commented 1 year ago

Thank you for your contribution fellow pizza man! 🍕

zaida04 commented 1 year ago

Hey! Thank you for the contribution, we really appreciate it :D

I did some changes on your PR for formatting/type narrowing to bring it up to merge standard. It is pending testing with our examples repo to ensure it stays consistent in behavior.

I have also done the following:

In regards to [2] in your footnotes: if we wanted to keep the same functionality but have different signatures so that there isn't incompatible type mix and matching, we could use method overloaders to enforce different, exclusive signatures.

Don't worry about any documentation regarding your changes either, as our TSDoc generator automatically creates new docs files for parsing/hosting on every commit/merge to main.

And a response to [1] as well, the guidelines are clear enough for us to understand. We had actually attempted in the past to conform to the logging standard set in that document, but ran into an issue as we wanted the actual Response object to also be passed as an object whole into an event on the .emitter property of the RestManager so that users could have opt-in logging on any REST request, regardless of failure or success. However, we found out it wasn't doable without consuming/cloning the Response object which was not advisable due to thread lockups. As such, we abandoned the attempt and settled on trying again later at some point before the publicization of the API (which we didn't hold ourselves to).

rkoval commented 1 year ago

oooh the method overloaders feature of TS is interesting. i think this would've been what i would've wanted had we kept the wonkiness i wrote :). thanks for the tip!

i think the other changes here make sense. thank you for cleaning this up! can you please post a screenshot though of the output from an error just so i can verify what it looks like?

zaida04 commented 1 year ago

(For record keeping sake, I'll note in this PR that screenshots of the error outputs were sent privately)

zaida04 commented 1 year ago

Thank you for the contribution! 🚀