Skip to content

Commit e01c9ec

Browse files
committed
Improve errors, no auth error for WS
1 parent 74b9abb commit e01c9ec

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

data-browser/src/handlers/sideBarHandler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ export function buildSideBarNewResourceHandler(store: Store) {
66
const parentSubject = resource.get(urls.properties.parent);
77

88
if (!isString(parentSubject)) {
9-
throw new Error("Resource doesn't have a parent");
9+
throw new Error(
10+
`Resource doesn't have a parent: ${resource.getSubject()} `,
11+
);
1012
}
1113

1214
const parent = await store.getResourceAsync(parentSubject);
@@ -31,7 +33,9 @@ export function buildSideBarRemoveResourceHandler(store: Store) {
3133
const parentSubject = resource.get(urls.properties.parent);
3234

3335
if (!isString(parentSubject)) {
34-
throw new Error("Resource doesn't have a parent");
36+
throw new Error(
37+
`Resource doesn't have a parent: ${resource.getSubject()} `,
38+
);
3539
}
3640

3741
const parent = await store.getResourceAsync(parentSubject);

lib/src/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ export class Store {
557557
setCookieAuthentication(this.serverUrl, agent);
558558

559559
this.webSockets.forEach(ws => {
560-
authenticate(ws, this);
560+
ws.readyState === ws.OPEN && authenticate(ws, this);
561561
});
562562

563563
this.resources.forEach(r => {

0 commit comments

Comments
 (0)