Allow methods to return a null result#865
Allow methods to return a null result#865daffl merged 4 commits intofeathersjs:masterfrom bertho-zero:null-result
Conversation
|
In my opinion result should be undefined, null can be a result. |
|
Totally agree. Sorry, my edit broke the build. We should definitely have a test for this, too. |
|
Allright, added a tests and everything is passing now. Took me a bit to realize that this change only applies when setting |
|
Released as 3.1.5, thank you! |
|
Do not you think that a service call should be able to return null as a value? without going through the error hook. This solution goes in the right direction but I am forced to create an error that is not one to change the result to null, which stops the chain of hooks in passing. For me:
|
|
|
|
You're right, after a more minimalist test it works. |
I do not know if this modification will break the tests of other packages of the ecosystem (I do not think) but it seems normal to me to be able to return null value without it being an error.
In my case I need to return null when I get a
softDeleted item instead of throw an error, the following code works with this PR:This can also be useful in a before hook for pass the service call and return null.