google / lovefield

Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.
https://google.github.io/lovefield/
Apache License 2.0
6.82k stars 367 forks source link

Errors should show messages, not URLs #241

Closed ssimo3lsuhsc closed 6 years ago

ssimo3lsuhsc commented 6 years ago

I really don't know why, when Lovefield throws exceptions, it has to give me the URL of a plain-text error message. I believe Lovefield should be able to AJAX GET the actual error message. I'm willing to fix this, but really don't know where to begin with unit testing.

I'm trying to turn the exception fragment code: 202, message: "http://google.github.io/lovefield/error_lookup/src/error_lookup.html?c=202&p0=trainings.dates" into code: 202, message: "Constraint error: (202) Attempted to insert NULL value to non-nullable field trainings.dates." Please bear in mind that the exception above is only an example. Please reread the first paragraph of my message if you do not understand what I take issue with. Thank you!

arthurhsu commented 6 years ago

This is by design. The reason is to reduce the size of generated file (it effectively reduces 20KB gzipped or so, I forgot the exact numbers). For our biggest customer GMail, adding 20KB per day means tera/peta bytes more traffic per year, and that's not a good thing.

Why we don't do AJAX GET? There are security concerns.

As a result, this is a compromise to sacrifice developer convenience to have a smaller, more secure library.