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

Report calling native hash when failing #2817

Closed
AvarianKnight opened this issue Sep 26, 2024 · 8 comments
Closed

Report calling native hash when failing #2817

AvarianKnight opened this issue Sep 26, 2024 · 8 comments

Comments

@AvarianKnight
Copy link
Contributor

AvarianKnight commented Sep 26, 2024

Segment

n/a

Importancy

Unclear or unintuitive

Improvement request

Currently calling a native with too large of a value (such as SetPedComponentVariation(ped, 12, 1, 0, 0) where 12 isn't a valid component id) will error with arg[1]: value too large, but this doesn't report the native used which can make it hard to debug what the error is.

Normal native execution fails would include the native hash of the native that was called to cause the error

fx::ScriptTrace("%s: execution failed: %s\n", __func__, e.what());
context.SetError("Execution of native %016llx in script host failed: %s", hash, e.what());

Area(s)

FiveM, Natives

Additional information

No response

@AvarianKnight AvarianKnight added documentation triage Needs a preliminary assessment to determine the urgency and required action labels Sep 26, 2024
@d22tny
Copy link

d22tny commented Sep 26, 2024

It normally has a stack trace attached but sometimes it doesn't show the stack trace. I opened a similar issue the first day the change was merged, and they've agreed that it would be okay to have the native hash included.

@AvarianKnight
Copy link
Contributor Author

Haven't had a case of no stack trace being opened, just one that's very uninformative

See:
uninformative error message

The line this point to is not useful at all

image

@st860923
Copy link

st860923 commented Oct 8, 2024

I encountered the same issue today where debugging lacks sufficient information, and the context is missing. In my case, the situation was even worse within ESX.Menu.Default, as the stack trace did not include any references from other resources.

image

I’m wondering if it would be better to change this to a warning instead? I noticed that throwing an error here directly can cause issues with some resources protected by Asset Escrow hosted by cfx. These resources are not open-sourced, and their authors are no longer providing support.

return SetError("arg[%i]: value too large (%i > %i)", i, arguments[i], maxValue);

@AvarianKnight
Copy link
Contributor Author

I’m wondering if it would be better to change this to a warning instead? I noticed that throwing an error here directly can cause issues with some resources protected by Asset Escrow hosted by cfx. These resources are not open-sourced, and their authors are no longer providing support.

This wouldn't be desired behavior, this should error as it is unexpected input, but it should error in a way can be debugged, which it currently doesn't.

@d22tny
Copy link

d22tny commented Oct 10, 2024

Seems like an improved error handling has been pushed. I'll check it out today.

@SuricatoX
Copy link

I encountered the same issue today where debugging lacks sufficient information, and the context is missing. In my case, the situation was even worse within ESX.Menu.Default, as the stack trace did not include any references from other resources.

image

I’m wondering if it would be better to change this to a warning instead? I noticed that throwing an error here directly can cause issues with some resources protected by Asset Escrow hosted by cfx. These resources are not open-sourced, and their authors are no longer providing support.

return SetError("arg[%i]: value too large (%i > %i)", i, arguments[i], maxValue);

As I could see, normally theres no trace when the script is obfuscated (in my case with luraph).

@SuricatoX
Copy link

Seems like an improved error handling has been pushed. I'll check it out today.

In server side, but client-side still https://cdn.discordapp.com/attachments/469246162239750184/1293966174132113469/image.png?ex=67094b68&is=6707f9e8&hm=17edfb97ec8b768672d72ac5b4b2f0a9448d4d8cee65cbd54373b84e7dac01aa&

@iridium-cfx
Copy link
Contributor

The native hash is now included when showing a validation error.

Also, the "value too large" error now silently fails (by not calling the native), to preserve backwards compatibility.

@github-actions github-actions bot removed the triage Needs a preliminary assessment to determine the urgency and required action label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants