fix(core): handle omitted group album success codes
Treat an absent media-list return code as the protobuf zero default while preserving failures for explicit non-zero codes. Add a regression test that exercises the encoded response path with media data and no status field. Refs #234
This commit is contained in:
2 files changed
+44
-2
No files matched your search
@@ -80,8 +80,9 @@ export class GroupAlbumApi {
|
||||
|
||||
const resp = protobuf_decode<GetMediaListResponse>(result.responseData);
|
||||
|
||||
if (resp.field1 !== 0) {
|
||||
throw new Error(`fetch album media list error: retCode ${resp.field1 ?? 'unknown'}`);
|
||||
const retCode = resp.field1 ?? 0;
|
||||
if (retCode !== 0) {
|
||||
throw new Error(`fetch album media list error: retCode ${retCode}`);
|
||||
}
|
||||
|
||||
const data = resp.data ?? {};
|
||||
|
||||
Reference in new issue
Block a user