Skip to content

Fix $try, custom function errors and crashes - #421

Open
Daaisukidayo wants to merge 10 commits into
tryforge:devfrom
Daaisukidayo:dev
Open

Daaisukidayo wants to merge 10 commits into
tryforge:devfrom
Daaisukidayo:dev

Conversation

@Daaisukidayo

@Daaisukidayo Daaisukidayo commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
  • $try catches raw exceptions and runs catch only on errors, including silent ones. $stop, $break, $continue and $return pass through it
  • Custom functions run their code through resolveCode instead of a nested Interpreter.run. Errors, $stop, $break and $continue come back to the caller. $try and the silent operator work around custom functions, $#return works inside them, $break and $continue affect the caller's loop
  • Silent operator now works at any depth and keeps the error in the Stop value so $try can read it
  • $callLocalFunction passes errors, $stop, $break and $continue up instead of returning them as text
  • $setTimeout, $setInterval, $async, $wsOn, $wsSend and the filters of $awaitMessage, $awaitComponent and $awaitModalSubmit log errors to console instead of losing them or crashing
  • Variables and JSON functions only use own keys. JSON functions can no longer reach Object.prototype, $get and $has no longer return values for names like toString, proto works as a normal name
  • Fixed $advancedBar hanging on negative or fractional length, length is capped at 4096
  • Fixed $setChannelArchiveDuration crashing on API errors and always returning true
  • Fixed ArgType.URL rejecting http:// links
  • Fixed $bufferLength, $bufferReadInt32, $bufferReadUtf8 and $bufferToString always returning nothing
  • Fixed $entitlementConsume not accepting its argument and returning a promise instead of bool
  • Added $setInviteTargetUsers, $updateInviteTargetUsers and the roles invite property

… JSON functions and crashes in $advancedBar, $setChannelArchiveDuration, websocket callbacks and $await filters
@Berk404
Berk404 requested a review from aggelos-007 November 4, 2026 19:39
…sers, fixed ArgType.Invite, ArgType.URL, buffer functions and $entitlementConsume
@Daaisukidayo

Daaisukidayo commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Added $setInviteRoles and $setInviteTargetUsers, used by the next $createInvite
  • Added $updateInviteTargetUsers for existing invites
  • Added roles property to invites
  • Fixed ArgType.Invite rejecting invite codes and links
  • Fixed ArgType.URL rejecting http links
  • Fixed $bufferLength, $bufferReadInt32, $bufferReadUtf8 and $bufferToString always returning nothing
  • Fixed $entitlementConsume never accepting its argument and returning a promise
  • Updated discord.js to 14.28.1

THESE CHANGES HAVEN'T YET BEEN TESTED

… errors inside the function, $arrayMap ignoring errors in the other variable field, $get and $has returning values for names like toString, and variables and local functions named __proto__ not working
…hown in the channel, the silent operator on custom functions still logging them to the console, and $eval inside custom functions logging its errors twice
…nside custom functions, $break and $continue within custom functions now affect loop in the calling code
@xNickyDev xNickyDev self-assigned this Nov 15, 2026
@xNickyDev xNickyDev added patch not tested Bug has not been reproduced blocked labels Nov 15, 2026
@xNickyDev

Copy link
Copy Markdown
Member

Your changes will be reviewed soon! There will be changes on how and where pull requests are merged into the codebase, more info on this will follow...

@xNickyDev xNickyDev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First review for suggested changes. Will review the other files soon with Aggelos.

Comment thread src/native/channel/createInvite.ts Resolved
Comment thread src/native/invite/setInviteRoles.ts Resolved
Comment thread src/structures/@internal/Context.ts Resolved
Comment thread src/structures/@internal/Context.ts Resolved

This branch has not been deployed

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

Labels

blocked not tested Bug has not been reproduced patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants