61
linuxxx
7y

It would be really FUCKING great if NodeJS or mysql could give me a FUCKING shout or ERROR MESSAGE when one of the parameters I'm giving is not the RIGHT FUCKING DATA TYPE INSTEAD OF THROWING A RANDOM ERROR THAT DOESN'T INDICATE A WRONG MOTHERFUCKING DATA TYPE. Five FUCKING hours of debugging later.

Comments
  • 6
    Have a look at TypeScript 😉
  • 0
    Well it does for me... Error handling
  • 0
    @vzqzac Yeah I do that but the error I got was a simple syntax error while one of the insert params was an object, which should throw some kind of row count error but not the thing I got
  • 1
    Oh I see, by the way, are you using raw queries or an ORM?
  • 0
    @vzqzac tbvh, I have no clue what an ORM is...
  • 1
    Its called "use an orm, not raw sql queries"
  • 0
    Does CoffeeScript support types "natively" ?
  • 0
    @linuxxx object-relational mapping, a programming technique that can help you with this issue, most popular library for node and SQL databases is sequelize, but there are plenty of them
  • 2
    Welcome to javascript
  • 0
  • 0
    here's where they tell u there's something that's gonna make ur life better. but it may not. but it maaaay. :)
  • 0
    @puerto what's that something? 😄
  • 0
    @linuxxx in this case, looks like sequelize. which btw, I hear is very good. I'm still Chucking normal old sql queries like u, I'm fine with it but u gotta do what works for u. just make sure it's not injectable. good luck either way.
  • 1
    @puerto Tbh, next to programming I'm the main cyber sec guy so making sure it's not injectable is always my first prio :)
  • 7
  • 0
    MySQL has strict mode.

    Activate it.

    Has nothing to do with ORM at all... Nothing.

    MySQL ignores all errors if no strict mode configuration applies and, what makes it worse, strict mode or better SQL mode as MySQL calls it, can be overridden per session / connection, so make sure nothing interferes.

    This is database specific, the ORM can help little to none.
  • 0
    @IntrusionCM k then 😔 haha
Add Comment