@@ -1805,7 +1805,9 @@ module openflow {
18051805 this . basequery = { _id : this . id } ;
18061806 this . loadData ( ) ;
18071807 } else {
1808- console . error ( "missing id" ) ;
1808+ this . errormessage = "missing id" ;
1809+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
1810+ console . error ( this . errormessage ) ;
18091811 }
18101812 } ) ;
18111813 $scope . $on ( 'queuemessage' , ( event , data : QueueMessage ) => {
@@ -1829,10 +1831,20 @@ module openflow {
18291831 async loadData ( ) : Promise < void > {
18301832 this . loading = true ;
18311833 var res = await this . api . Query ( this . collection , this . basequery , null , { _created : - 1 } , 1 ) ;
1832- if ( res . length > 0 ) { this . workflow = res [ 0 ] ; } else { console . error ( this . id + " workflow not found!" ) ; return ; }
1834+ if ( res . length > 0 ) { this . workflow = res [ 0 ] ; } else {
1835+ this . errormessage = this . id + " workflow not found!" ;
1836+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
1837+ console . error ( this . errormessage ) ;
1838+ return ;
1839+ }
18331840 if ( this . instanceid !== null && this . instanceid !== undefined && this . instanceid !== "" ) {
18341841 var res = await this . api . Query ( "workflow_instances" , { _id : this . instanceid } , null , { _created : - 1 } , 1 ) ;
1835- if ( res . length > 0 ) { this . model = res [ 0 ] ; } else { console . error ( this . id + " workflow instances not found!" ) ; return ; }
1842+ if ( res . length > 0 ) { this . model = res [ 0 ] ; } else {
1843+ this . errormessage = this . id + " workflow instances not found!" ;
1844+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
1845+ console . error ( this . errormessage ) ;
1846+ return ;
1847+ }
18361848 // console.debug(this.model);
18371849 // console.debug(this.model.form);
18381850 // console.debug("form: " + this.model.form);
@@ -1860,11 +1872,16 @@ module openflow {
18601872 if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
18611873 return ;
18621874 } else {
1863- console . error ( this . model . form + " form not found! " + this . model . state ) ; return ;
1875+ this . errormessage = this . model . form + " form not found! " + this . model . state ;
1876+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
1877+ console . error ( this . errormessage ) ;
1878+ return ;
18641879 }
18651880 }
18661881 } else {
1867- console . debug ( "Model contains no form" ) ;
1882+ this . errormessage = "Model contains no form" ;
1883+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
1884+ console . error ( this . errormessage ) ;
18681885 }
18691886 this . renderform ( ) ;
18701887 } else {
@@ -1880,6 +1897,9 @@ module openflow {
18801897 try {
18811898 result = JSON . parse ( result ) ;
18821899 } catch ( error ) {
1900+ this . errormessage = "Model contains no form" ;
1901+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
1902+ console . error ( this . errormessage ) ;
18831903 }
18841904 // console.debug(result);
18851905 // if ((this.instanceid === undefined || this.instanceid === null) && (result !== null && result !== unescape)) {
@@ -2186,7 +2206,9 @@ module openflow {
21862206 this . Save ( ) ;
21872207 } )
21882208 this . formioRender . on ( 'error' , ( errors ) => {
2189- console . error ( errors ) ;
2209+ this . errormessage = errors ;
2210+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
2211+ console . error ( this . errormessage ) ;
21902212 } ) ;
21912213 }
21922214 if ( this . model . state == "completed" || this . model . state == "failed" ) {
0 commit comments