Skip to content

App crashes when on MySQL error #1539

@hohomouse

Description

@hohomouse

Hi team,

I am quite new to nodejs.
I searched the issues and not found the same, hence come to create a new issue.

I already added on 'error' function, like this:

con.on('error', function(err){
    console.log(err.code);
});

But whenever MySQL error happens like selecting non-exists table, my App always crashes.

select * from not_exists_table
/home/user/my-project/node_modules/mysql/lib/protocol/Parser.js:78
        throw err; // Rethrow non-MySQL errors
        ^
Error:
 ER_NO_SUCH_TABLE: Table 'my-database.not_exists_table' doesn't exist

Don't know how to make App don't crash when MySQL error happens.

Thanks,
HoHo

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions