Skip to content
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

Improve error message if a frontend version is not valid #3913

Open
jtpio opened this issue May 1, 2024 · 0 comments
Open

Improve error message if a frontend version is not valid #3913

jtpio opened this issue May 1, 2024 · 0 comments

Comments

@jtpio
Copy link
Member

jtpio commented May 1, 2024

Problem

Currently, the widget manager for JupyterLab displays an error message when there is version mismatch (added in #3185), which is useful as it is also displayed in the output cell:

if (!mod) {
const registeredVersionList = Object.keys(allVersions);
throw new Error(
`Module ${moduleName}, version ${moduleVersion} is not registered, however, \
${registeredVersionList.join(',')} ${
registeredVersionList.length > 1 ? 'are' : 'is'
}`
);
}

The semver cache checks the maxSatisfying version here:

const best = maxSatisfying(Object.keys(versions), semver);

But it does not check if the provided version is valid.

One possible source of confusion would be if the frontend version is not set properly. For example a value of 1.8.0a0 is not valid according to the valid function from the semver package:

image

This is reproducible with the (now deprecated) Jupyter Widget cookiecutter, by creating a new widget and changing the version to 0.1.0a0:

image

Error: Module jupyter-widget-example, version ^0.1.0a0 is not registered, however,         0.1.0a0 is

Proposed Solution

Additional context

Maybe we could first check if the provided version is valid, and update the error message so it's less confusing to users when the issue is about a malformed version?

cc @ohrely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant