@samitouri / QOSami-HFS / commits / f391bdc4

fix: admin/internet: failed port-mapping didn't show an error

Massimo Melina committed Aug 1, 2024 at 16:52 UTC f391bdc4e11be39339ba5cd6f44740af213511e8
1 file changed +3
src/api.net.ts
+3
@@ -54,6 +54,9 @@ const apis: ApiHandlers = {
54 catch (e: any) { return new ApiError(HTTP_SERVER_ERROR, 'removeMapping failed: ' + String(e) ) }
55 if (external) // must use the object form of 'public' to work around a bug of the library
56 await upnpClient.createMapping({ private: internal || internalPort, public: { host: '', port: external }, description: 'hfs', ttl: 0 })
57 + .catch(res => {
58 + throw new ApiError(res.errorCode, res.errorCode === 718 ? "Port not available" : res.errorDescription)
59 + })
60 return {}
61 },
62