mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-13 04:53:01 +00:00
Fix bug with umwarranted error messages
This commit is contained in:
@@ -110,13 +110,21 @@ const GroupEdit = (props) => {
|
||||
|
||||
Promise.all(promiseQueue)
|
||||
.then((data) => {
|
||||
data.status < 300
|
||||
// ensure status of all requests are < 300
|
||||
let allPassed =
|
||||
data.map((e) => e.status).filter((e) => e >= 300).length ==
|
||||
0;
|
||||
|
||||
allPassed
|
||||
? updateGroups(0, limit)
|
||||
.then((data) => dispatchPageUpdate(data, 0))
|
||||
.then(() => history.push("/groups"))
|
||||
: setErrorAlert(`Failed to edit group.`);
|
||||
})
|
||||
.catch(() => setErrorAlert(`Failed to edit group.`));
|
||||
.catch(() => {
|
||||
console.log("outer");
|
||||
setErrorAlert(`Failed to edit group.`);
|
||||
});
|
||||
}}
|
||||
>
|
||||
Apply
|
||||
|
@@ -242,17 +242,17 @@ const ServerDashboard = (props) => {
|
||||
onClick={() =>
|
||||
stopServer(e.name)
|
||||
.then((res) => {
|
||||
data < 300
|
||||
? updateUsers(...slice)
|
||||
if (res.status < 300) {
|
||||
updateUsers(...slice)
|
||||
.then((data) => {
|
||||
dispatchPageUpdate(data, page);
|
||||
})
|
||||
.catch(() =>
|
||||
setErrorAlert(
|
||||
`Failed to update users list.`
|
||||
)
|
||||
)
|
||||
: setErrorAlert(`Failed to stop server`);
|
||||
setErrorAlert(`Failed to update users list.`)
|
||||
);
|
||||
} else {
|
||||
setErrorAlert(`Failed to stop server.`);
|
||||
}
|
||||
return res;
|
||||
})
|
||||
.catch(() => setErrorAlert(`Failed to stop server.`))
|
||||
@@ -267,17 +267,17 @@ const ServerDashboard = (props) => {
|
||||
onClick={() =>
|
||||
startServer(e.name)
|
||||
.then((res) => {
|
||||
data < 300
|
||||
? updateUsers(...slice)
|
||||
if (res.status < 300) {
|
||||
updateUsers(...slice)
|
||||
.then((data) => {
|
||||
dispatchPageUpdate(data, page);
|
||||
})
|
||||
.catch(() =>
|
||||
setErrorAlert(
|
||||
`Failed to update users list.`
|
||||
)
|
||||
)
|
||||
: setErrorAlert(`Failed to start server`);
|
||||
setErrorAlert(`Failed to update users list.`)
|
||||
);
|
||||
} else {
|
||||
setErrorAlert(`Failed to start server.`);
|
||||
}
|
||||
return res;
|
||||
})
|
||||
.catch(() => {
|
||||
|
@@ -33,11 +33,7 @@ var serverDashboardJsx = (spy) => (
|
||||
);
|
||||
|
||||
var mockAsync = (data) =>
|
||||
jest
|
||||
.fn()
|
||||
.mockImplementation(() =>
|
||||
Promise.resolve({ json: () => Promise.resolve(data ? data : { k: "v" }) })
|
||||
);
|
||||
jest.fn().mockImplementation(() => Promise.resolve(data ? data : { k: "v" }));
|
||||
|
||||
var mockAsyncRejection = () =>
|
||||
jest.fn().mockImplementation(() => Promise.reject());
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user