Skip to content

Update callback.lua#1668

Merged
Kenshiin13 merged 1 commit into
esx-framework:mainfrom
cjosephdc:patch-1
Jul 13, 2025
Merged

Update callback.lua#1668
Kenshiin13 merged 1 commit into
esx-framework:mainfrom
cjosephdc:patch-1

Conversation

@cjosephdc

Copy link
Copy Markdown
Contributor

Description

This PR modifies the Callbacks:Execute method to improve error handling when a callback fails.

Motivation

Using error() after pcall() defeats the purpose of safe error handling and can cause disruptive stack traces or unwanted crashes during runtime (e.g., when spawning an invalid vehicle model). This change allows errors to be logged without halting execution.


Implementation Details

  • Replaced error(errorString) with print() to prevent script crashes when a callback throws an error.
  • Ensures callback execution failures are logged cleanly without interrupting overall execution flow.

This PR modifies the Callbacks:Execute method to improve error handling when a callback fails.
@github-project-automation github-project-automation Bot moved this to 🆕 To be Discussed in ESX Roadmap Jul 11, 2025
@Kenshiin13

Copy link
Copy Markdown
Contributor

I don't see any issues with throwing an error. Setting currentId to nil on failure is a good catch though.

@Kenshiin13 Kenshiin13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks.

@github-project-automation github-project-automation Bot moved this from 🆕 To be Discussed to Ready for Next Update in ESX Roadmap Jul 13, 2025
@Kenshiin13 Kenshiin13 merged commit c64a3b5 into esx-framework:main Jul 13, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Next Update

Development

Successfully merging this pull request may close these issues.

3 participants