Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rbartley
Specialist II
Specialist II

Single API - random ErrorCode.-2

Hi everyone,

I have seen a number of posts relating to ErrorCode.-2, but I could not find one that matches my case. 

I have a mashup page that uses the Single API to show around 20 visualizations.  Sometimes they will all load fine the first time I load the page, other times I get one or several ErrorCode.-2 messages but where the chart appears perfectly behind the message (see below).  However, the next time I refresh the page, the visualization that had the ErrorCode.-2 will be fine, but another vis will show the same error (or on other occasions there are no errors at all).  This leads me to conclude that this has nothing to do with the visualizations or the app, but is due to some internal Qlik bug, perhaps sequencing.

 

rbartley_0-1634899900347.png

In the browser console, I can see a number of errors, such as the one shown below:

rbartley_1-1634900197897.png

Does anyone have any ideas how to resolve the issue, or how to suppress the error message?  I tried using the on(error,function()) method, but since I'm using the Single API, this isn't working.

Any help greatly appreciated.

 

p.s. I am not using any extensions.

 

@ErikWetterberg , any ideas?

Labels (1)
  • API

14 Replies
rbartley
Specialist II
Specialist II
Author

Hi @kishore3k ,

I added a return true statement within the require call (since I don't want to display any message or at all or handle the error in any particular way other than to ignore it) but I still receive the error message.  In fact this error 2 code is rather misleading since the charts are shown anyway and on clicking cancel it's as though there was never an error.  Do you have any suggestions that might help to just suppress the error?

require( ["js/qlik"], function ( qlik ) {

	...
	qlik.setOnError( function ( error ) {
		if (error.code == 2) { //Access Denied
			return true;
		}
		else
		{
			...
		}
		
	} );

 

 

 

kishore3k
Partner - Contributor III
Partner - Contributor III

if you have window.qv or anything, comment out that try again......also see if you have setonerror in any other controller and if anything in other controllers, bring everything to main controller. 

As i see your code, the errors should only be showing for error code =2 everything should be ignored.

I dont know how to to fix the error code -2 and my suggestion was more of a workaround.

rbartley
Specialist II
Specialist II
Author

@kishore3k Thanks for replying.  Sorry, I don't understand your response.

What is window.qv?

I confirm that I only have setonerror in this controller.

When you say: "As i see your code, the errors should only be showing for error code =2... "  Why do you think that this would show the error code. If I override errorcode 2 with return true, shouldn't that prevent the Qlik error window from appearing when errorcode 2 is found?  That it my intention.

Thanks again.

kishore3k
Partner - Contributor III
Partner - Contributor III

I am not sure .....I just thought returning true might trigger the modal of error from Qlik.

Have you tried removing below set of code? 

qlik.setOnError( function ( error ) {
		if (error.code == 2) { //Access Denied
			return true;
		}
		else
		{
			...
		}
		
	} );

you can try. If you do not want to show any errors.

rbartley
Specialist II
Specialist II
Author

I raised a support ticket with Qlik for this and had a discussion with one of the employees.  It appears that we cannot trap the error being returned by the Single Integration API, and the error handling I included in the Capability API code to handle filtering associated with the drop-down list  was never triggered.  Therefore, I decided to remove the default filter from the iframe URLs and handle it all via the Capability API.  This appears to have resolved the issue, so I assume that it was due to some sort of conflict between the two filtering methods.