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

sendToAsync always returns error state #1198

Closed
Marty56 opened this issue Nov 23, 2022 · 5 comments
Closed

sendToAsync always returns error state #1198

Marty56 opened this issue Nov 23, 2022 · 5 comments

Comments

@Marty56
Copy link

Marty56 commented Nov 23, 2022

Describe the bug
The "sendToAsync" function returns an error, even when the function is correctly executed.
The error contains the result of the function.

Screenshots & Logfiles

async function sum2(id,timestart,timeend,db) {
    var return_value
    var query = 'SELECT * FROM "autogen"."' + id + id +'"'
    try {
            return_value = await sendToAsync(db, 'query', query);
            log("Return Value:" + JSON.stringify(return_value))
    } 
    catch (error) {
        console.error("Error Message: " + JSON.stringify(error))
    }         
    return ;
}

(async ()  => {
    await sum2(path2db + 'Auto_Ex.Tag_Energie',firstdayofyear + seach_time_start,yesterday +seach_time_end ,endless)
 })();

LogFile

script.js.common.Energie: Error Message: {"result":[[]],"ts":1669200882840,"error":null}

Versions:

  • Adapter version: 6.0.3
  • JS-Controller version: 4.0.23
  • Node version: v16.18.1
  • Operating system: Debian Bullseye
@Marty56
Copy link
Author

Marty56 commented Nov 23, 2022

Mir erscheint, dass in Zeile in dem File javascript/lib/tools.js in Zeile 82 die Parameter "error" und "result" vertauscht sind..

also
fn.apply(context, [...args, (error, result) => {
muss in

fn.apply(context, [...args, (result, error,) => {

geändert werden.

In meinem laienhaften Verständnis müssten alle "Async" functions betroffen sein.

@Apollon77
Copy link
Contributor

Please try GitHub version if fixed

@Marty56
Copy link
Author

Marty56 commented Jan 16, 2023

Seems to work now. Thanks for the fix.

@Marty56 Marty56 closed this as completed Jan 16, 2023
@Marty56
Copy link
Author

Marty56 commented Jan 16, 2023

closed

@Apollon77
Copy link
Contributor

Lets leave open until released :-)

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

3 participants