Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Reduce all worker exceptions to common #1249

Closed
maslenitsa93 opened this issue Mar 27, 2019 · 4 comments
Closed

Reduce all worker exceptions to common #1249

maslenitsa93 opened this issue Mar 27, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@maslenitsa93
Copy link

Currently there are too many different worker logic exception types (>30).
But most of evaluators are throwing 2 or 3 exceptions only.

If client is a software, the common error description is enough.
E.g.: incorrect_techspec_state.

If client is a human (e.g. user of cli_wallet, or programmer who plays with API), he can read the message of the exception. Single exception can be used with few messages. Also, it anyway should be described in documentation: which operation for which techspec state.

@maslenitsa93
Copy link
Author

There are 2 ways to make common exceptions:

  1. Just use common logic_exception:

error: incorrect_techspec_state
msg: Techspec should be in work, wip or not approved

error: incorrect_techspec_state
msg: Techspec should be complete

error: incorrect_techspec_state
msg: Techspec should be in work or wip

  1. Use our own exception type (as it made in bandwidth_exception) with special field correct_states:

error: incorrect_techspec_state
correct_states: [created, work, wip]
msg: Techspec should be in work, wip or not approved

error: incorrect_techspec_state
correct_states: [complete]
msg: Techspec should be complete

error: incorrect_techspec_state
correct_states: [work, wip]
msg: Techspec should be in work or wip

@maslenitsa93
Copy link
Author

maslenitsa93 commented Mar 28, 2019

Same way should be used to declare incorrect_worker_proposal_state (created/techspec) and incorrect_worker_proposal_type (premade/task).

Also, another logic exceptions can be just replaced with single logic exception without custom fields.

@maslenitsa93 maslenitsa93 self-assigned this Apr 7, 2019
@maslenitsa93 maslenitsa93 added this to the 0.21.0 milestone Apr 7, 2019
maslenitsa93 added a commit that referenced this issue May 30, 2019
maslenitsa93 added a commit that referenced this issue May 31, 2019
maslenitsa93 added a commit that referenced this issue May 31, 2019
@maslenitsa93
Copy link
Author

maslenitsa93 commented May 31, 2019

error: incorrect_techspec_state
correct_states: [created, work, wip]
msg: Techspec should be in work, wip or not approved

It should be 2 exceptions - Techspec is already finished and Techspec is not yet approved. Message for client should be informative. Client should just translate it to user language and show to user.
Solution with incorrect_techspec_state don't allow to separate exceptions without wasting LOCs. I will implement another solution.

@maslenitsa93
Copy link
Author

PR #1321

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant