-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some secrets
commands throw an undefined
error
#311
Comments
A similar behaviour is seen when trying to remove the vault root using |
I find that occurrences like this indicates a significant lack of quality control and specification review. You need go back to the drawing board and review the entire behaviour and isolate the tests and fastcheck the commands. |
secrets write
doesn't gracefully handle writing to a directorysecrets
commands throw an undefined
error
Brian and I investigated this, and we have found the culprit for this issue. The root cause is that This is then reconstructed incorrectly in the client side in Polykey CLI. The output formatter expects an object of type This happens because the type of the error when we pass it into the output formatter is When deserialising the error, the formatter appends This needs twofold action. First, all operations in In the future, any operations which could raise errors must be explicitly managed and wrapped for the errors to be properly propagated in Polykey. |
async function mkdir(...) {
try {
// Throws an `EncryptedFSError`
} catch (e) {
if (e.code === 'EEXIST') {
// Wrap the error
}
throw e;
// Unwrapped error can potentially escape
}
} This code can still technically throw an unwrapped error, which can propagate through the RPC and become an However, chances are, in this function, it can return only throw the errors that we are explicitly catching, so it's fine here, but how would this be handled in other |
Why not have a generic catch all? What do you mean unwrapped? |
When we catch exceptions, we check if the exception is the one we expect. In that case, the relevant exception is caught, wrapped in, say, This comment was made before our discussion of dealing with unexpected errors at the root, from within |
Describe the bug
When writing to a directory, the command should provide appropriate feedback bail out. This should either be done immediately (by preemptively checking if the target is a valid file path or not), or later, by raising an appropriate error.
Currently, it just returns this output, which is not really explicit or apparent in what went wrong:
To Reproduce
Expected behavior
As in
secrets cat
, an error could be raised:Screenshots
Platform
["0.10.0","1.14.0","1","1"]
Additional context
Notify maintainers
@aryanjassal
The text was updated successfully, but these errors were encountered: