When using the package to register custom protocols on a system running KDE, an error is thrown if the protocol isn't already registered. This behaviour stems from the xdg-mime utility's defapp_kde function treating a query for a non-existent protocol as a failure, thus returning an exit code of 4 ("The action failed"). This is then interpreted by protocol-registry as an error condition, even though this behaviour is expected and appropriate when checking for a non-existent protocol.
To Reproduce:
Install and use the protocol-registry package in a Node.js application on a KDE-based system.
Try to register a custom protocol that isn't already registered on the system.
protocol-registry will throw an error, indicating that the xdg-mime query default x-scheme-handler/{protocol} command failed.
Expected behaviour:
protocol-registry should handle the exit code 4 from xdg-mime as an indication that the protocol does not exist, rather than as an error. No error should be thrown when attempting to register a new protocol that does not already have a handler.
Describe the bug:
When using the package to register custom protocols on a system running KDE, an error is thrown if the protocol isn't already registered. This behaviour stems from the
xdg-mime
utility'sdefapp_kde
function treating a query for a non-existent protocol as a failure, thus returning an exit code of 4 ("The action failed"). This is then interpreted by protocol-registry as an error condition, even though this behaviour is expected and appropriate when checking for a non-existent protocol.To Reproduce:
protocol-registry
package in a Node.js application on a KDE-based system.protocol-registry
will throw an error, indicating that thexdg-mime query default x-scheme-handler/{protocol}
command failed.Expected behaviour:
protocol-registry
should handle the exit code 4 fromxdg-mime
as an indication that the protocol does not exist, rather than as an error. No error should be thrown when attempting to register a new protocol that does not already have a handler.