Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions recaptcha_enterprise/demosite/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def on_signup() -> Response:
}
}
)
except ValueError or Exception as e:
except Exception as e:
return jsonify({"data": {"error_msg": str(e.__dict__)}})
Comment on lines +104 to 105

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using str(e.__dict__) typically returns an empty dictionary string ('{}') for standard Python exceptions because they do not store their error messages in __dict__. To return the actual error message, use str(e) instead.

Suggested change
except Exception as e:
return jsonify({"data": {"error_msg": str(e.__dict__)}})
except Exception as e:
return jsonify({"data": {"error_msg": str(e)}})



Expand Down Expand Up @@ -150,7 +150,7 @@ def on_login() -> Response:
}
}
)
except ValueError or Exception as e:
except Exception as e:
return jsonify({"data": {"error_msg": str(e.__dict__)}})
Comment on lines +153 to 154

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using str(e.__dict__) typically returns an empty dictionary string ('{}') for standard Python exceptions because they do not store their error messages in __dict__. To return the actual error message, use str(e) instead.

Suggested change
except Exception as e:
return jsonify({"data": {"error_msg": str(e.__dict__)}})
except Exception as e:
return jsonify({"data": {"error_msg": str(e)}})



Expand Down Expand Up @@ -198,7 +198,7 @@ def on_store_checkout() -> Response:
}
}
)
except ValueError or Exception as e:
except Exception as e:
return jsonify({"data": {"error_msg": str(e.__dict__)}})
Comment on lines +201 to 202

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using str(e.__dict__) typically returns an empty dictionary string ('{}') for standard Python exceptions because they do not store their error messages in __dict__. To return the actual error message, use str(e) instead.

Suggested change
except Exception as e:
return jsonify({"data": {"error_msg": str(e.__dict__)}})
except Exception as e:
return jsonify({"data": {"error_msg": str(e)}})



Expand Down Expand Up @@ -246,7 +246,7 @@ def on_comment_submit() -> Response:
}
}
)
except ValueError or Exception as e:
except Exception as e:
return jsonify({"data": {"error_msg": str(e.__dict__)}})
Comment on lines +249 to 250

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using str(e.__dict__) typically returns an empty dictionary string ('{}') for standard Python exceptions because they do not store their error messages in __dict__. To return the actual error message, use str(e) instead.

Suggested change
except Exception as e:
return jsonify({"data": {"error_msg": str(e.__dict__)}})
except Exception as e:
return jsonify({"data": {"error_msg": str(e)}})



Expand Down
Loading