feathers icon indicating copy to clipboard operation
feathers copied to clipboard

DB Adapter error handler

Open DaddyWarbucks opened this issue 1 year ago • 2 comments

For both the Knex and MongoDB adapters, the error handling should be more customizable. Right now both adapters import an errorHandler from another file. This makes it difficult to customize errors because we have to override each method to do so. Instead, both classes should be updated with a handleError and use that. Then the user could extend the class and only overwrite one method to customize error handler for all the other methods.

DaddyWarbucks avatar Feb 20 '25 15:02 DaddyWarbucks

Good point, that would be a fairly easy non-breaking change.

I'm still a bit on the fence about what to do with the adapters in general. In most projects I'm now just using either Kysely or just plain SQL directly. With LLMs being quite good at SQL (and MongoDB) queries it feels like all those abstractions on top of it have become a lot less useful.

There still is the Wings initiative at https://github.com/feathersdev/wings which aimed at making the adapters Feathers independent (and using those in your services) but I'm not sure if it makes sense as a long-term project anymore.

daffl avatar Feb 20 '25 19:02 daffl

I actually just opened a PR for this update to feathers-sequelize also. I had noticed some errors that came straight from Sequelize that contain more DB info than I am comfortable sharing with the client. I will get around to opening PR's for these two libraries.

I would love to move away from Sequelize for my main project...I am jumping through more hoops than I am using features. Drizzle interests me because you get a basic CRUD interface with it.

I am a fan of Wings. If I were building an app in Express or Koa I would definitely reach for it. Me being a Feathers insider, I would currently reach for the classes directly and use them even outside of a Feathers app. So having Wings makes sense to me.

I think there should always be a SQL and Mongo adapter closely coupled with Feathers. Whether that be in core or Wings, I think its important there is some "official" adapter for those two. It just makes newbies feel safe and encourages "best practices". I wouldn't want to recreate my SQL/Mongo adapter every project.

DaddyWarbucks avatar Feb 20 '25 19:02 DaddyWarbucks