fix: admin/internet: failed port-mapping didn't show an error
Massimo Melina committed
Aug 1, 2024 at 16:52 UTC
c38be5541331eb5b094144d75f158d8601646fed
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