mirror of
https://github.com/nushell/nushell.git
synced 2025-07-06 17:40:17 +02:00
Improve the error message for a plugin version mismatch (#12122)
# Description Previously, the plugin itself would also print error messages about mismatched versions, and there could be many of them while parsing a `register` command which would be hard to follow. This removes that behavior so that the error message is easier to read, and also makes the error message on the engine side mention the plugin name so that it's easier to tell which plugin needs to be updated. The python plugin has also been modified to make testing this behavior easier. Just change `NUSHELL_VERSION` in the script file to something incompatible. # User-Facing Changes - Better error message # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib`
This commit is contained in:
@ -27,6 +27,9 @@ import sys
|
||||
import json
|
||||
|
||||
|
||||
NUSHELL_VERSION = "0.91.1"
|
||||
|
||||
|
||||
def signatures():
|
||||
"""
|
||||
Multiple signatures can be sent to Nushell. Each signature will be registered
|
||||
@ -175,7 +178,7 @@ def tell_nushell_hello():
|
||||
hello = {
|
||||
"Hello": {
|
||||
"protocol": "nu-plugin", # always this value
|
||||
"version": "0.90.2",
|
||||
"version": NUSHELL_VERSION,
|
||||
"features": []
|
||||
}
|
||||
}
|
||||
@ -216,7 +219,10 @@ def write_error(id, msg, span=None):
|
||||
|
||||
def handle_input(input):
|
||||
if "Hello" in input:
|
||||
return
|
||||
if input["Hello"]["version"] != NUSHELL_VERSION:
|
||||
exit(1)
|
||||
else:
|
||||
return
|
||||
elif input == "Goodbye":
|
||||
return
|
||||
elif "Call" in input:
|
||||
|
Reference in New Issue
Block a user