Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion 2 linode_api4/polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EventError(Exception):

def __init__(self, event_id: int, message: Optional[str]):
# Edge case, sometimes the message is populated with an empty string
if len(message) < 1:
if message is not None and len(message) < 1:
message = None

self.event_id = event_id
Expand Down
14 changes: 14 additions & 0 deletions 14 test/unit/objects/polling_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,17 @@ def test_wait_for_event_finished_failed(
assert err.message == "oh no!"
else:
raise Exception("Expected event error, got none")

def test_event_error(
self,
):
"""
Tests that EventError objects can be constructed and
will be formatted to the correct output.

Tests for regression of TPT-3060
"""

assert str(EventError(123, None)) == "Event 123 failed"
assert str(EventError(123, "")) == "Event 123 failed"
assert str(EventError(123, "foobar")) == "Event 123 failed: foobar"
Morty Proxy This is a proxified and sanitized view of the page, visit original site.