StorePushError doesn't grok the new store error responses
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Fix Released
|
Medium
|
Sergio Schvezov |
Bug Description
When trying to push a snap to the wrong store an error response was generated, but snapcraft crashed without showing an appropriate error message built from the response. This seems to be because the StorePushError exception is trying to get the 'text' from the response's json but there isn't one. How to reproduce:
Apply this change to snapcraft to send a store header:
diff --git a/snapcraft/
index 8d8e208..853e0ad 100644
--- a/snapcraft/
+++ b/snapcraft/
@@ -582,6 +582,7 @@ class SCAClient(Client):
+ 'X-Ubuntu-Store': 'whatever',
if not response.ok:
raise errors.
- Try to push a snap
This is what I get:
Traceback (most recent call last):
File "/usr/lib/
snapcraft.
File "/usr/lib/
store.
File "/usr/lib/
self.
File "/usr/lib/
return func(*args, **kwargs)
File "/usr/lib/
raise errors.
snapcraft.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/
obj=
File "/usr/lib/
return self.main(*args, **kwargs)
File "/usr/lib/
rv = self.invoke(ctx)
File "/usr/lib/
return _process_
File "/usr/lib/
return ctx.invoke(
File "/usr/lib/
return callback(*args, **kwargs)
File "/usr/lib/
echo.error(e)
File "/usr/lib/
click.
File "/usr/lib/
return self.fmt.format([], **self.__dict__)
KeyError: 'text'
The response contains this (note: no text).
b'{"error_list": [{"message": "Invalid store.", "code": "invalid-field", "extra": {"field": "X-Ubuntu-Store", "value": "planeo"}}]}'
Changed in snapcraft: | |
milestone: | 2.35 → none |
Changed in snapcraft: | |
status: | Fix Committed → Fix Released |
Did the API change