-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(v2client): fix retry exceeded error code description and action
- Loading branch information
1 parent
8279b77
commit 938ed4c
Showing
5 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import typing | ||
|
||
import click | ||
|
||
from riocli.constants import Colors | ||
from riocli.v2client.errors import ERRORS | ||
|
||
|
||
def process_errors(errors: typing.List[str]) -> str: | ||
err_fmt = '[{}] {}\nAction: {}' | ||
support_action = ('Report the issue together with the relevant' | ||
' details to the support team') | ||
|
||
action, description = '', '' | ||
msgs = [] | ||
for code in errors: | ||
if code in ERRORS: | ||
description = ERRORS[code]['description'] | ||
action = ERRORS[code]['action'] | ||
elif code.startswith('DEP_E2'): | ||
description = 'Internal rapyuta.io error in the components deployed on cloud' | ||
action = support_action | ||
elif code.startswith('DEP_E3'): | ||
description = 'Internal rapyuta.io error in the components deployed on a device' | ||
action = support_action | ||
elif code.startswith('DEP_E4'): | ||
description = 'Internal rapyuta.io error' | ||
action = support_action | ||
|
||
code = click.style(code, fg=Colors.YELLOW) | ||
description = click.style(description, fg=Colors.RED) | ||
action = click.style(action, fg=Colors.GREEN) | ||
|
||
msgs.append(err_fmt.format(code, description, action)) | ||
|
||
return '\n'.join(msgs) |