File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import {get, translate} from 'lit-translate';
3
3
import { newLogEvent , newWizardEvent , Wizard } from "../foundation.js" ;
4
4
5
5
import { CompasSclDataService , SDS_NAMESPACE } from "../compas-services/CompasSclDataService.js" ;
6
- import { createLogEvent } from "../compas-services/foundation.js" ;
6
+ import { createLogEvent , isNotFoundError , NOT_FOUND_ERROR } from "../compas-services/foundation.js" ;
7
7
import { getTypeFromDocName , updateDocumentInOpenSCD } from "../compas/foundation.js" ;
8
8
import { getElementByName , getOpenScdElement , styles } from './foundation.js' ;
9
9
import { addVersionToCompasWizard } from "../compas/CompasUploadVersion.js" ;
@@ -53,6 +53,11 @@ export default class CompasVersionsPlugin extends LitElement {
53
53
CompasSclDataService ( ) . listVersions ( type , this . docId )
54
54
. then ( xmlResponse => {
55
55
this . scls = Array . from ( xmlResponse . querySelectorAll ( 'Item' ) ?? [ ] ) ;
56
+ } )
57
+ . catch ( reason => {
58
+ if ( isNotFoundError ( reason ) ) {
59
+ this . scls = [ ] ;
60
+ }
56
61
} ) ;
57
62
}
58
63
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ export function handleError(error: Error): Promise<never> {
69
69
return Promise . reject ( { type : SERVER_ERROR , message : error . message } ) ;
70
70
}
71
71
72
+ export function isNotFoundError ( reason : any ) : boolean {
73
+ return ( reason . type && reason . type === NOT_FOUND_ERROR ) ;
74
+ }
75
+
72
76
export function createLogEvent ( reason : any ) : void {
73
77
let message = reason . message ;
74
78
if ( reason . status ) {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import {property} from "lit-element";
3
3
import { LitElementConstructor , Mixin } from "../foundation.js" ;
4
4
5
5
import { CompasSclDataService } from "../compas-services/CompasSclDataService.js" ;
6
- import { NOT_FOUND_ERROR } from "../compas-services/foundation.js" ;
6
+ import { isNotFoundError , NOT_FOUND_ERROR } from "../compas-services/foundation.js" ;
7
7
import { getTypeFromDocName } from "./foundation.js" ;
8
8
9
9
export type CompasExistsInElement = Mixin < typeof CompasExistsIn > ;
@@ -33,7 +33,7 @@ export function CompasExistsIn<TBase extends LitElementConstructor>(Base: TBase)
33
33
this . callService ( docType , this . docId )
34
34
. then ( ( ) => this . existInCompas = true )
35
35
. catch ( reason => {
36
- if ( reason . type && reason . type === NOT_FOUND_ERROR ) {
36
+ if ( isNotFoundError ( reason ) ) {
37
37
this . existInCompas = false ;
38
38
}
39
39
} ) ;
You can’t perform that action at this time.
0 commit comments