Skip to content

Commit 939dab1

Browse files
committed
error handling: don't tell user to retry if that won't help
1 parent 5191791 commit 939dab1

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

app/auth/intent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def update_user_with_info(
174174
result = self._data_source.save_user(user)
175175

176176
if not result.was_intent_successful:
177-
result.error_msg = "Failed to update your info! Please retry"
177+
result.error_msg = "Failed to update your info! "
178178
result.log_message_if_any()
179179
return result
180180

app/clients/intent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def save_client(
7575

7676
if not result.was_intent_successful:
7777
result.log_message_if_any()
78-
result.error_msg = "Failed to save the client! Please retry"
78+
result.error_msg = "Failed to save the client! "
7979
return result
8080

8181
def get_all_contacts_as_map(self) -> Mapping[int, Contact]:

app/contacts/intent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_contact_by_id(self, contact_id) -> IntentResult[Contact]:
5252
"""
5353
result: IntentResult[Contact] = self._data_source.get_contact_by_id(contact_id)
5454
if not result.was_intent_successful:
55-
result.error_msg = "Retrieving contact failed. Please retry"
55+
result.error_msg = "Retrieving contact failed. "
5656
result.log_message_if_any()
5757
return result
5858

@@ -81,7 +81,7 @@ def save_contact(self, contact: Contact) -> IntentResult[Union[Contact, None]]:
8181
)
8282
result = self._data_source.save_contact(contact=contact)
8383
if not result.was_intent_successful:
84-
result.error_msg = "Saving contact failed. Please retry"
84+
result.error_msg = "Saving contact failed. "
8585
result.log_message_if_any()
8686
return result
8787

app/contracts/intent.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_contract_by_id(self, contractId) -> IntentResult[Optional[Contract]]:
5252
"""
5353
result = self._data_source.get_contract_by_id(contractId)
5454
if not result.was_intent_successful:
55-
result.error_msg = "Failed to load contract details. Please retry"
55+
result.error_msg = "Failed to load contract details. "
5656
result.log_message_if_any()
5757
return result
5858

@@ -206,7 +206,7 @@ def delete_contract_by_id(self, contract_id: str):
206206
"""Deletes the contract with the given id"""
207207
result: IntentResult = self._data_source.delete_contract_by_id(contract_id)
208208
if not result.was_intent_successful:
209-
result.error_msg = "Failed to delete that contract! Please retry"
209+
result.error_msg = "Failed to delete that contract! "
210210
result.log_message_if_any()
211211
return result
212212

@@ -217,9 +217,7 @@ def toggle_complete_status(self, contract: Contract) -> IntentResult[Contract]:
217217
if not result.was_intent_successful:
218218
# undo the change
219219
contract.is_completed = not contract.is_completed
220-
result.error_msg = (
221-
"Failed to update the completed status of the contract. Please retry"
222-
)
220+
result.error_msg = "Failed to update the completed status of the contract. "
223221
result.log_message_if_any()
224222
result.data = contract
225223
return result

app/invoicing/intent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def delete_invoice_by_id(self, invoice_id) -> IntentResult[None]:
8383
logger.exception(ex)
8484
return IntentResult(
8585
was_intent_successful=False,
86-
message="Could not delete invoice. ",
86+
error_msg="Could not delete invoice. ",
8787
)
8888

8989
def create_invoice(

app/projects/intent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def save_project(
7979
if old_project_result.was_intent_successful
8080
else None
8181
)
82-
result.error_msg = "Failed to save the project. Please retry"
82+
result.error_msg = "Failed to save the project. "
8383
result.log_message_if_any()
8484
return result
8585

@@ -170,7 +170,7 @@ def delete_project_by_id(self, project_id: str) -> IntentResult[None]:
170170
"""
171171
result: IntentResult = self._data_source.delete_project_by_id(project_id)
172172
if not result.was_intent_successful:
173-
result.error_msg = "Failed to delete that project! Please retry"
173+
result.error_msg = "Failed to delete that project! "
174174
result.log_message_if_any()
175175
return result
176176

0 commit comments

Comments
 (0)