Giter Club home page Giter Club logo

Comments (8)

TimonKK avatar TimonKK commented on August 15, 2024

Can you give me a example code with reproduce? You can use system.number as data

from clickhouse.

choppsta avatar choppsta commented on August 15, 2024

An easy way to reproduce is to try and insert to a table that doesn't exist:

const {ClickHouse} = require('clickhouse');

const ch = new ClickHouse({host: 'localhost'});

const stream = ch.insert('INSERT INTO BAD_TABLE').stream();

for (let i = 0; i < 10; i++) {
    stream.writeRow([i, 'test: '+i]);
}

stream.exec().catch(err => {
    console.log(err.code, err.message);
    // outputs: undefined 404: Not Found
});

stream.ws.on('response', res => {
    let body = '';
    res.on('data', data => body += data);
    res.on('end', () => {
        console.log(body);
        // outputs: Code: 60, e.displayText() = DB::Exception: Table default.BAD_TABLE doesn't exist. (version 20.3.8.53 (official build))
    });
})

from clickhouse.

TimonKK avatar TimonKK commented on August 15, 2024

If you exec insert as stream then Clickhouse doesn't return body, only error code 500. In last realises Clickhouse sends error code in header, but text still missed

from clickhouse.

choppsta avatar choppsta commented on August 15, 2024

When I run the example above it returns 404 and the body is:
Code: 60, e.displayText() = DB::Exception: Table default.BAD_TABLE doesn't exist. (version 20.3.8.53 (official build))

I can get the error message by manually listening for the response and processing the body, but it would be good if this was rejected by exec() like other errors.

from clickhouse.

TimonKK avatar TimonKK commented on August 15, 2024

Ok, I will patch code like your example

from clickhouse.

choppsta avatar choppsta commented on August 15, 2024

That's great, thank you!

from clickhouse.

TimonKK avatar TimonKK commented on August 15, 2024

I published [email protected] with your suggestion. Enjoy!

from clickhouse.

choppsta avatar choppsta commented on August 15, 2024

That's fantastic, thank you so much!

from clickhouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.