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

Uncaught TypeError when running from inside FiveM's FXServer. #1490

Closed
2 tasks done
tabarra opened this issue Oct 7, 2020 · 1 comment · Fixed by #1491
Closed
2 tasks done

Uncaught TypeError when running from inside FiveM's FXServer. #1490

tabarra opened this issue Oct 7, 2020 · 1 comment · Fixed by #1491
Labels
enhancement This change will extend Got features external The issue related to an external project

Comments

@tabarra
Copy link
Contributor

tabarra commented Oct 7, 2020

Describe the bug

  • Node.js version: 12+ (probably irrelevant)
  • OS & version: irrelevant

When running inside FiveM's runtime environment, errors cause an unhandled TypeError when inferring the stack is an string.
I know this is kinda niche issue, but an issue nontheless.
Changing !is.undefined(error.stack) to is_1.string(error.stack) in HERE solves it! I'll make an PR for that in a bit.

Actual behavior

Its not even caught by the uncaughtException process event due to how FXServer node integration works. The following is just printed to the console.

Executing got()
Error calling system tick function in resource monitor: TypeError: this.stack.slice(...).split is not a function
stack:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Expected behavior

Executing got()
HANDLED ERROR

Code to reproduce

const got = require('got');

(async () => {
    try {
        console.log('Executing got()');
        await got('https://google.com/', { timeout: 1, retry: 0 }).text();
        console.log('Done.');
    } catch (err) {
        console.log('HANDLED ERROR');
    }
})()

process.on('uncaughtException', function(err) {
    console.log('UNHANDLED ERROR');
});

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.
tabarra added a commit to tabarra/got that referenced this issue Oct 7, 2020
tabarra added a commit to tabarra/got that referenced this issue Oct 7, 2020
@szmarczak szmarczak added enhancement This change will extend Got features external The issue related to an external project labels Oct 10, 2020
@szmarczak szmarczak reopened this Nov 2, 2020
@trippythabum
Copy link

I have this problem can someone help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This change will extend Got features external The issue related to an external project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants