Skip to content

Conversation

@cirosantilli
Copy link
Contributor

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.

@TeatroIO
Copy link

I've prepared a stage. Click to open.

@cirosantilli cirosantilli force-pushed the factor-service-error branch 2 times, most recently from dec4a8c to d8cf9ef Compare September 21, 2014 08:39
@Razer6
Copy link
Member

Razer6 commented Sep 21, 2014

👍

@Razer6 Razer6 added this to the 7.4 milestone Sep 21, 2014
dzaporozhets added a commit that referenced this pull request Sep 22, 2014
Factor error and success methods from services.
@dzaporozhets dzaporozhets merged commit db12e2d into gitlabhq:master Sep 22, 2014
@cirosantilli cirosantilli deleted the factor-service-error branch September 22, 2014 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants