mikee47 / ConfigDB

Configuration database for Sming
GNU General Public License v3.0
3 stars 1 forks source link

reporting errors #49

Open pljakobs opened 2 months ago

pljakobs commented 2 months ago

(this was first a comment on the "additional schema items" issue but really deserves it's own issue.

I think as this gets more and more feature rich, we will need some way of properly reporting errors. To keep things simple, I would love to see the full error in it's own json structure, maybe as a sort of "virtual store"? So basically, a function yields an error, let's say importFromStream. In this case, the local app can't really do much to work with the error, but I could use something like

if(!cfg.importFromStream(ConfigDB::Json::format, *bodyStream))
    response.sendDataStream(cfg.error.getStream());

maybe?

From the application side, I think this could be an array of objects, so the app could iterate through them if it wants to handle them locally.