Skip to content

Commit f973bcf

Browse files
committed
Add nice warning instead of cryptic error for missing unlock url's
1 parent 5d14cc2 commit f973bcf

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/endpoints/explorer/unlock.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,24 @@ router.get('/', async function (req, res, next) {
1717

1818
const unlock = await DB.getLensUnlock(lensId);
1919
if (unlock && unlock[0]) {
20-
// trigger re-download to catch missing files automatically
21-
await Util.downloadUnlock(unlock[0].lens_id, unlock[0].lens_url);
20+
if (unlock[0].lens_id && unlock[0].lens_url) {
21+
// trigger re-download to catch missing files automatically
22+
await Util.downloadUnlock(unlock[0].lens_id, unlock[0].lens_url);
2223

23-
return res.json(Util.modifyResponseURLs(unlock[0]));
24-
} else {
25-
const remoteUnlock = await getRemoteUnlockByLensId(lensId);
26-
if (remoteUnlock) {
27-
return res.json(remoteUnlock);
24+
return res.json(Util.modifyResponseURLs(unlock[0]));
25+
} else {
26+
console.warn('Unlock Download URL is missing', lensId);
2827
}
2928
}
3029

30+
const remoteUnlock = await getRemoteUnlockByLensId(lensId);
31+
if (remoteUnlock) {
32+
return res.json(remoteUnlock);
33+
}
34+
35+
// TODO FIX in upcomming versions
36+
console.warn('This Lens can not be used. The issue is known and will most likely be fixed in upcomming versions of Snap Camera Server.', lensId);
37+
3138
return res.json({});
3239
});
3340

0 commit comments

Comments
 (0)