Factor error and success methods from services.
Created by: cirosantilli
The most important factorization here is to fix a single status: :error
and status: :sucess
keys for all services.
The DeleteBranch
service had already started diverging as is used the key :state
instead of :status
.
For the error, it was also possible to factor out the message
as it is used on all returns. The same was not possible for success
.
The initialize signature was modified in order to allow to use inheritance. This also makes the execute function parameters lists shorter since project
and current_user
now go on the initializer like all other services.
The next step would be to have an uniform error reporting across all services: some create services currently return the created object with errors added by .errors.add
. Maybe we should just follow that for all services as it is cleaner than playing with hashes.